{
  "$schema": "https://openworkflowgraph.org/schemas/core/v0.92.json",
  "owg_version": "0.92",
  "id": "mddf-avails-offer",
  "project_id": "mddf-avails-offer",
  "profiles": ["core"],
  "description": "MovieLabs MDDF binding — offering a registered edit to a retailer. An Avails document (territory, license type, window) and a Media Manifest travel with the edit, each as a governed asset carrying its MDDF identifier next to the edit's EIDR IDs. Validation and business-affairs approval are tasks. In v0.92 the licensing terms live inside the Avails document; OWG does not yet hold them as structured rights nodes (see the Rights page). All IDs are placeholders.",
  "objective": "Validate an Avails document against the edit it describes, get the terms approved, and send the offer with a Media Manifest, keeping the link between the edit, its EIDR IDs and the terms it was offered under.",
  "organizations": [
    { "id": "org_studio", "name": "Example Studio", "role": "studio" },
    { "id": "org_retailer", "name": "Example Retailer", "role": "distributor" }
  ],
  "participants": [
    { "id": "svc_avails", "kind": "service", "name": "Avails Builder", "organization_id": "org_studio" },
    { "id": "svc_validator", "kind": "service", "name": "MDDF Validator", "organization_id": "org_studio" },
    { "id": "svc_delivery", "kind": "service", "name": "Retailer Delivery", "organization_id": "org_studio" },
    { "id": "biz_affairs", "kind": "human", "name": "Business Affairs", "role": "supervisor", "organization_id": "org_studio" }
  ],
  "infrastructure": [
    { "id": "cloud_platform", "type": "saas_platform", "owner": "org_studio" },
    { "id": "retailer_portal", "type": "saas_platform", "owner": "org_retailer", "product": "Retailer ingest portal" }
  ],
  "assets": [
    {
      "id": "edit_fr",
      "role": "source",
      "type": "video.master",
      "content_type": "video/mp4",
      "state": "accepted",
      "identifiers": [
        { "scope": "eidr.title", "id": "10.5240/0000-0000-0000-0000-0000-A" },
        { "scope": "eidr.edit",  "id": "10.5240/0000-0000-0000-0000-2222-C" }
      ],
      "storage": { "provider": "s3", "locator": "s3://studio-masters/example-title/fr/master.mp4", "zone": "us-west-2" }
    },
    {
      "id": "avails_doc",
      "role": "intermediate",
      "type": "document.avails",
      "content_type": "application/xml",
      "produced_by": "build_avails",
      "state": "in_review",
      "identifiers": [
        { "scope": "mddf.avails", "id": "urn:uuid:8d2e6a14-3b57-4f91-a0c3-5e7b1d9f2c68" }
      ],
      "storage": { "provider": "s3", "locator": "s3://studio-offers/example-title/fr/avails.xml", "zone": "us-west-2" },
      "metadata": {
        "x-mddf": { "component": "Avails", "version": "2.25", "format": "xml" }
      }
    },
    {
      "id": "media_manifest",
      "role": "intermediate",
      "type": "document.manifest",
      "content_type": "application/xml",
      "produced_by": "build_avails",
      "identifiers": [
        { "scope": "mddf.manifest", "id": "urn:uuid:f0b17c93-6a2d-4e58-9d41-8c3a7e5b2d10" }
      ],
      "storage": { "provider": "s3", "locator": "s3://studio-offers/example-title/fr/manifest.xml", "zone": "us-west-2" },
      "metadata": {
        "x-mddf": { "component": "Media Manifest Core" }
      }
    },
    {
      "id": "validation_report",
      "role": "intermediate",
      "type": "document.note",
      "content_type": "application/json",
      "produced_by": "validate_offer",
      "storage": { "provider": "s3", "locator": "s3://studio-offers/example-title/fr/validation.json", "zone": "us-west-2" }
    }
  ],
  "tasks": [
    {
      "id": "build_avails",
      "label": "Build Avails and Media Manifest for the edit",
      "type": "task",
      "executor": { "type": "service", "ref": "mddf.build", "environment": "saas" },
      "performed_by": "svc_avails",
      "ran_on": "cloud_platform",
      "used": ["edit_fr"],
      "produced": ["avails_doc", "media_manifest"],
      "failure_mode": "HALT"
    },
    {
      "id": "validate_offer",
      "label": "Validate Avails and manifest against the schemas and the edit",
      "type": "qc",
      "executor": { "type": "service", "ref": "mddf.validate", "environment": "saas" },
      "performed_by": "svc_validator",
      "ran_on": "cloud_platform",
      "used": ["avails_doc", "media_manifest", "edit_fr"],
      "produced": ["validation_report"],
      "checks": ["schema_valid", "eidr_ids_match_edit", "territory_codes", "window_dates"],
      "depends_on": ["build_avails"],
      "failure_mode": "HALT"
    },
    {
      "id": "approve_terms",
      "label": "Business affairs approves the terms",
      "type": "review",
      "executor": { "type": "human", "ref": "review.approve", "environment": "desktop" },
      "performed_by": "biz_affairs",
      "used": ["avails_doc", "validation_report"],
      "depends_on": ["validate_offer"],
      "failure_mode": "HALT"
    },
    {
      "id": "send_offer",
      "label": "Send Avails and manifest to the retailer",
      "type": "delivery",
      "executor": { "type": "saas_api", "ref": "deliver.retailer", "environment": "saas" },
      "performed_by": "svc_delivery",
      "ran_on": "retailer_portal",
      "used": ["avails_doc", "media_manifest"],
      "depends_on": ["approve_terms"],
      "failure_mode": "HALT"
    }
  ]
}
