{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "/schemas/3.1.0-rc.4/content-standards/update-content-standards-request.json",
  "title": "Update Content Standards Request",
  "description": "Request parameters for updating an existing content standards configuration. Creates a new version.",
  "type": "object",
  "allOf": [
    {
      "$ref": "/schemas/3.1.0-rc.4/core/version-envelope.json"
    }
  ],
  "x-mutates-state": true,
  "properties": {
    "standards_id": {
      "type": "string",
      "description": "ID of the standards configuration to update"
    },
    "scope": {
      "type": "object",
      "description": "Updated scope for where this standards configuration applies",
      "properties": {
        "countries_all": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "description": "ISO 3166-1 alpha-2 country codes. Standards apply in ALL listed countries (AND logic)."
        },
        "channels_any": {
          "type": "array",
          "items": {
            "$ref": "/schemas/3.1.0-rc.4/enums/channels.json"
          },
          "minItems": 1,
          "description": "Advertising channels. Standards apply to ANY of the listed channels (OR logic)."
        },
        "languages_any": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "description": "BCP 47 language tags (e.g., 'en', 'de', 'fr'). Standards apply to content in ANY of these languages (OR logic). Content in unlisted languages is not covered by these standards."
        },
        "description": {
          "type": "string",
          "description": "Human-readable description of this scope"
        }
      }
    },
    "registry_policy_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "x-entity": "governance_registry_policy"
      },
      "description": "Registry policy IDs to use as the evaluation basis. When provided, the agent resolves policies from the registry and uses their policy text and exemplars as the evaluation criteria."
    },
    "policies": {
      "type": "array",
      "description": "Updated bespoke policies for this content-standards configuration, using the same shape as registry entries. Replaces the existing policies array; use stable policy_ids to track policies across versions. Combines with registry_policy_ids. Bespoke policy_ids MUST be flat (no colons/slashes).",
      "items": {
        "$ref": "/schemas/3.1.0-rc.4/governance/policy-entry.json"
      },
      "minItems": 1
    },
    "calibration_exemplars": {
      "type": "object",
      "description": "Updated training/test set to calibrate policy interpretation. Use URL references for pages to be fetched and analyzed, or full artifacts for pre-extracted content.",
      "properties": {
        "pass": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "description": "URL reference - specific page to fetch and evaluate",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "url",
                    "description": "Indicates this is a URL reference"
                  },
                  "value": {
                    "type": "string",
                    "format": "uri",
                    "description": "Full URL to a specific page (e.g., 'https://espn.com/nba/story/_/id/12345/lakers-win')"
                  },
                  "language": {
                    "type": "string",
                    "description": "BCP 47 language tag for content at this URL"
                  }
                },
                "required": [
                  "type",
                  "value"
                ]
              },
              {
                "$ref": "/schemas/3.1.0-rc.4/content-standards/artifact.json",
                "description": "Full artifact with pre-extracted content (text, images, video, audio)"
              }
            ]
          },
          "description": "Content that passes the standards"
        },
        "fail": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "description": "URL reference - specific page to fetch and evaluate",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "url",
                    "description": "Indicates this is a URL reference"
                  },
                  "value": {
                    "type": "string",
                    "format": "uri",
                    "description": "Full URL to a specific page (e.g., 'https://news.example.com/controversial-article')"
                  },
                  "language": {
                    "type": "string",
                    "description": "BCP 47 language tag for content at this URL"
                  }
                },
                "required": [
                  "type",
                  "value"
                ]
              },
              {
                "$ref": "/schemas/3.1.0-rc.4/content-standards/artifact.json",
                "description": "Full artifact with pre-extracted content (text, images, video, audio)"
              }
            ]
          },
          "description": "Content that fails the standards"
        }
      }
    },
    "context": {
      "$ref": "/schemas/3.1.0-rc.4/core/context.json"
    },
    "ext": {
      "$ref": "/schemas/3.1.0-rc.4/core/ext.json"
    },
    "idempotency_key": {
      "type": "string",
      "description": "Client-generated unique key for at-most-once execution. If a request with the same key has already been processed, the server returns the original response without re-processing. MUST be unique per (seller, request) pair to prevent cross-seller correlation. Use a fresh UUID v4 for each request.",
      "minLength": 16,
      "maxLength": 255,
      "pattern": "^[A-Za-z0-9_.:-]{16,255}$"
    }
  },
  "required": [
    "idempotency_key",
    "standards_id"
  ],
  "additionalProperties": true
}
