Brand Studio docs
Engineering manualSchema reference

Brand Studio link-first media state

Declared schema: schemas/media-link-state.schema.json

Source: schemas/media-link-state.schema.json. This is the complete declaration, including nested definitions and constraints. Its presence is not evidence that a runtime producer or consumer validates against it.

All schemas · Data structures and lineage

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://brand.mirrorfactory.ai/schemas/media-link-state.schema.json",
  "title": "Brand Studio link-first media state",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "media_id",
    "canonical_post_url",
    "canonical_media_url",
    "role",
    "delivery",
    "storage",
    "size_evidence"
  ],
  "properties": {
    "schema_version": {
      "const": "brand-studio-media-link-state/v1"
    },
    "media_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "canonical_post_url": {
      "type": "string",
      "format": "uri",
      "minLength": 1
    },
    "canonical_media_url": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "role": {
      "enum": [
        "primary",
        "carousel_slide",
        "poster",
        "thumbnail",
        "transcript",
        "audio",
        "preview",
        "original"
      ]
    },
    "delivery": {
      "$ref": "#/$defs/delivery"
    },
    "storage": {
      "$ref": "#/$defs/storage"
    },
    "size_evidence": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/sizeEvidence"
      }
    }
  },
  "$defs": {
    "delivery": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "delivery_url",
        "delivery_url_identity_sha256",
        "observed_at",
        "expires_at",
        "refresh_strategy",
        "provenance"
      ],
      "properties": {
        "state": {
          "enum": [
            "current",
            "expired",
            "refresh_required",
            "unavailable",
            "rights_restricted"
          ]
        },
        "delivery_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "pattern": "^[^?]+$"
        },
        "delivery_url_identity_sha256": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[a-f0-9]{64}$"
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "expires_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "refresh_strategy": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "adapter_id",
                "action_id"
              ],
              "properties": {
                "adapter_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "action_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                }
              }
            }
          ]
        },
        "provenance": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "method",
            "source_ref"
          ],
          "properties": {
            "method": {
              "enum": [
                "platform_metadata",
                "post_scoped_dom",
                "structured_response",
                "local_file",
                "not_observed"
              ]
            },
            "source_ref": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 800
            }
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "state": {
                "const": "current"
              }
            },
            "required": [
              "state"
            ]
          },
          "then": {
            "type": "object",
            "properties": {
              "observed_at": {
                "type": "string",
                "format": "date-time"
              }
            },
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "delivery_url": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "delivery_url_identity_sha256": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        }
      ]
    },
    "storage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "state",
        "policy",
        "artifacts",
        "last_error"
      ],
      "properties": {
        "state": {
          "enum": [
            "referenced",
            "proxy_queued",
            "proxy_ready",
            "original_available",
            "original_queued",
            "original_archived",
            "expired",
            "unavailable",
            "rights_restricted",
            "fetch_failed"
          ]
        },
        "policy": {
          "enum": [
            "link_first",
            "selected_proxy",
            "explicit_original"
          ]
        },
        "artifacts": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "poster",
            "transcript",
            "proxy",
            "original"
          ],
          "properties": {
            "poster": {
              "$ref": "#/$defs/artifactOrNull"
            },
            "transcript": {
              "$ref": "#/$defs/artifactOrNull"
            },
            "proxy": {
              "$ref": "#/$defs/artifactOrNull"
            },
            "original": {
              "$ref": "#/$defs/artifactOrNull"
            }
          }
        },
        "last_error": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "code",
                "message",
                "observed_at"
              ],
              "properties": {
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 160
                },
                "message": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                },
                "observed_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "state": {
                "const": "proxy_ready"
              }
            },
            "required": [
              "state"
            ]
          },
          "then": {
            "type": "object",
            "properties": {
              "artifacts": {
                "type": "object",
                "properties": {
                  "proxy": {
                    "$ref": "#/$defs/artifact"
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "state": {
                "const": "original_archived"
              }
            },
            "required": [
              "state"
            ]
          },
          "then": {
            "type": "object",
            "properties": {
              "artifacts": {
                "type": "object",
                "properties": {
                  "original": {
                    "$ref": "#/$defs/artifact"
                  }
                }
              }
            }
          }
        }
      ]
    },
    "artifactOrNull": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/artifact"
        }
      ]
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "bytes",
        "sha256",
        "mime_type",
        "created_at"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
        },
        "bytes": {
          "type": "integer",
          "minimum": 0
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "mime_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "sizeEvidence": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "target",
        "method",
        "classification",
        "bytes",
        "confidence",
        "observed_at",
        "source_ref",
        "limitations"
      ],
      "properties": {
        "target": {
          "enum": [
            "poster",
            "transcript",
            "proxy",
            "original"
          ]
        },
        "method": {
          "enum": [
            "measured_file_size",
            "content_length",
            "platform_format_metadata",
            "observed_bitrate",
            "platform_baseline",
            "unknown"
          ]
        },
        "classification": {
          "enum": [
            "known",
            "estimated",
            "unknown"
          ]
        },
        "bytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "confidence": {
          "enum": [
            "high",
            "medium",
            "low",
            "unknown"
          ]
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "source_ref": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 800
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "uniqueItems": true
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "classification": {
                "const": "unknown"
              }
            },
            "required": [
              "classification"
            ]
          },
          "then": {
            "type": "object",
            "properties": {
              "method": {
                "const": "unknown"
              },
              "bytes": {
                "type": "null"
              },
              "confidence": {
                "const": "unknown"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "classification": {
                "enum": [
                  "known",
                  "estimated"
                ]
              }
            },
            "required": [
              "classification"
            ]
          },
          "then": {
            "type": "object",
            "properties": {
              "bytes": {
                "type": "integer"
              },
              "confidence": {
                "enum": [
                  "high",
                  "medium",
                  "low"
                ]
              }
            }
          }
        }
      ]
    }
  }
}