{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-created-media-schema.json",
  "title": "CreatedMedia",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-media-api-openapi.yml#/components/schemas/CreatedMedia",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/MediaId"
    },
    "organizationId": {
      "$ref": "#/$defs/OrganizationId"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "uploading",
        "processing",
        "ready",
        "failed",
        "deleted"
      ]
    },
    "filename": {
      "type": "string"
    },
    "contentType": {
      "type": "string"
    },
    "sizeBytes": {
      "type": "number",
      "minimum": 0
    },
    "width": {
      "anyOf": [
        {
          "type": "number",
          "exclusiveMinimum": 0
        },
        {
          "type": "null"
        }
      ]
    },
    "height": {
      "anyOf": [
        {
          "type": "number",
          "exclusiveMinimum": 0
        },
        {
          "type": "null"
        }
      ]
    },
    "durationMs": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "null"
        }
      ]
    },
    "purpose": {
      "type": "string",
      "enum": [
        "attachment",
        "avatar",
        "review_evidence"
      ]
    },
    "checksumSha256": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "expiresAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "createdAt": {
      "type": "string"
    },
    "confirmedAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "upload": {
      "$ref": "#/$defs/MediaUploadInstruction"
    }
  },
  "required": [
    "id",
    "organizationId",
    "status",
    "filename",
    "contentType",
    "sizeBytes",
    "width",
    "height",
    "durationMs",
    "purpose",
    "checksumSha256",
    "expiresAt",
    "createdAt",
    "confirmedAt",
    "upload"
  ],
  "additionalProperties": false,
  "$defs": {
    "MediaId": {
      "type": "string",
      "pattern": "^media_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "MediaId"
    },
    "MediaUploadInstruction": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "method": {
          "type": "string",
          "enum": [
            "PUT"
          ]
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "expiresAt": {
          "type": "string"
        }
      },
      "required": [
        "url",
        "method",
        "headers",
        "expiresAt"
      ],
      "additionalProperties": false
    },
    "OrganizationId": {
      "type": "string",
      "pattern": "^org_[0-9a-hjkmnp-tv-z]{16,24}$",
      "x-samva-brand": "OrganizationId"
    }
  }
}