{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/track/json-schema/track-contract-details-schema.json",
  "title": "ContractDetails",
  "description": "Shared helpers to serialize release and recording information.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/track-openapi.yml#/components/schemas/ContractDetails",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "label": {
      "type": "string",
      "format": "uuid"
    },
    "label_name": {
      "type": "string",
      "readOnly": true
    },
    "payees": {
      "type": "string"
    },
    "starting_balance": {
      "type": [
        "string",
        "null"
      ],
      "format": "decimal",
      "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$",
      "writeOnly": true
    },
    "name": {
      "type": "string"
    },
    "contract_type": {
      "$ref": "#/$defs/ContractTypeEnum"
    },
    "status": {
      "$ref": "#/$defs/Status65cEnum"
    },
    "start_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "end_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "territory": {
      "type": "string",
      "maxLength": 128
    },
    "currency": {
      "type": "string",
      "maxLength": 3
    },
    "royalty_basis": {
      "$ref": "#/$defs/RoyaltyBasisEnum"
    },
    "distribution_fee_percent": {
      "type": [
        "string",
        "null"
      ],
      "format": "decimal",
      "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
    },
    "label_share_percent": {
      "type": [
        "string",
        "null"
      ],
      "format": "decimal",
      "pattern": "^-?\\d{0,3}(?:\\.\\d{0,2})?$"
    },
    "label_share_overrides": {
      "type": [
        "object",
        "null"
      ],
      "description": "Per-category overrides of label_share_percent. Values are the label's share as decimal strings between 0.00 and 100.00; a missing key falls back to label_share_percent.",
      "properties": {
        "ad_revenue": {
          "type": "string"
        },
        "cd": {
          "type": "string"
        },
        "downloads": {
          "type": "string"
        },
        "expenses": {
          "type": "string"
        },
        "licensing": {
          "type": "string"
        },
        "misc": {
          "type": "string"
        },
        "physical": {
          "type": "string"
        },
        "radio": {
          "type": "string"
        },
        "streaming": {
          "type": "string"
        },
        "video": {
          "type": "string"
        },
        "vinyl": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "payment_threshold": {
      "type": "string",
      "format": "decimal",
      "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
    },
    "advance_amount": {
      "type": "string",
      "format": "decimal",
      "pattern": "^-?\\d{0,10}(?:\\.\\d{0,2})?$"
    },
    "cross_collateralized": {
      "type": "boolean"
    },
    "file": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri"
    },
    "notes": {
      "type": "string"
    },
    "verified_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "extracting_status": {
      "type": "string",
      "readOnly": true
    },
    "statement_period": {
      "nullable": true,
      "oneOf": [
        {
          "$ref": "#/$defs/StatementPeriodEnum"
        },
        {
          "$ref": "#/$defs/BlankEnum"
        },
        {
          "$ref": "#/$defs/NullEnum"
        }
      ]
    },
    "tracks_count": {
      "type": "integer",
      "readOnly": true,
      "default": 0
    },
    "first_sound_recording_title": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    },
    "all_tracks_have_isrc": {
      "type": "boolean",
      "readOnly": true,
      "default": true
    },
    "can_delete": {
      "type": "boolean",
      "readOnly": true
    },
    "can_activate": {
      "type": "boolean",
      "readOnly": true
    },
    "has_revenue": {
      "type": "boolean",
      "readOnly": true,
      "default": false
    },
    "has_expenses": {
      "type": "boolean",
      "readOnly": true,
      "default": false
    },
    "related_releases": {
      "type": "string",
      "readOnly": true
    },
    "related_recordings": {
      "type": "string",
      "readOnly": true
    },
    "rates_locked": {
      "type": "boolean",
      "readOnly": true
    }
  },
  "required": [
    "all_tracks_have_isrc",
    "can_activate",
    "can_delete",
    "created_at",
    "extracting_status",
    "first_sound_recording_title",
    "has_expenses",
    "has_revenue",
    "id",
    "label",
    "label_name",
    "rates_locked",
    "related_recordings",
    "related_releases",
    "tracks_count",
    "updated_at"
  ],
  "$defs": {
    "BlankEnum": {
      "enum": [
        ""
      ]
    },
    "ContractTypeEnum": {
      "enum": [
        "recording",
        "distribution",
        "licensing",
        "producer",
        "featured_artist",
        "exclusive_license",
        "360"
      ],
      "type": "string",
      "description": "* `recording` - Recording\n* `distribution` - Distribution\n* `licensing` - Licensing\n* `producer` - Producer\n* `featured_artist` - Featured Artist\n* `exclusive_license` - Exclusive License\n* `360` - 360 Deal"
    },
    "NullEnum": {
      "enum": [
        null
      ]
    },
    "RoyaltyBasisEnum": {
      "enum": [
        "net_receipts",
        "gross"
      ],
      "type": "string",
      "description": "* `net_receipts` - Net Receipts\n* `gross` - Gross"
    },
    "StatementPeriodEnum": {
      "enum": [
        "monthly",
        "quarterly",
        "half_yearly",
        "annually"
      ],
      "type": "string",
      "description": "* `monthly` - Monthly\n* `quarterly` - Quarterly\n* `half_yearly` - Half-Yearly\n* `annually` - Annually"
    },
    "Status65cEnum": {
      "enum": [
        "draft",
        "active",
        "ended"
      ],
      "type": "string",
      "description": "* `draft` - Draft\n* `active` - Active\n* `ended` - Ended"
    }
  }
}