{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://theamateur.co.uk/schemas/dpl/dpl.brief-1.schema.json",
  "title": "DPL drafting brief (dpl.brief/1)",
  "description": "The small typed input `dpl draft start <brief.json>` reads: a title, a target runtime and a profile (film or short), and optionally a logline, a thesis, characters, places, and, for the short profile, the delivery platform, kit, people and shoot window. This schema describes exactly what the dpl reader accepts: unknown members, misspelt terms and fractional numbers are refused.",
  "$comment": "Structure only. `dpl draft start` also checks what a schema cannot: that characters and places make different plan ids, that a person's character is a character of the brief, that the short-form members are not given to a film, and that the shoot window runs forward.",
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "const": "dpl.brief/1"
    },
    "title": {
      "type": "string",
      "pattern": "\\S"
    },
    "target_runtime_ms": {
      "description": "The planned length of the finished work, in whole milliseconds.",
      "type": "integer",
      "minimum": 1
    },
    "profile": {
      "$ref": "#/$defs/BriefProfile"
    },
    "logline": {
      "description": "What happens, in a sentence or two. It becomes the skeleton's work.approach until the agent writes a real one.",
      "type": [
        "string",
        "null"
      ]
    },
    "thesis": {
      "description": "What the work argues or makes the audience feel. It becomes the skeleton's work.thesis.",
      "type": [
        "string",
        "null"
      ]
    },
    "characters": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BriefCharacter"
      }
    },
    "places": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BriefPlace"
      }
    },
    "delivery": {
      "anyOf": [
        {
          "$ref": "#/$defs/BriefDelivery"
        },
        {
          "type": "null"
        }
      ]
    },
    "kit": {
      "description": "Short profile: what the crew shoots with, in the plan's own kit shape.",
      "anyOf": [
        {
          "$ref": "#/$defs/Kit"
        },
        {
          "type": "null"
        }
      ]
    },
    "people": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BriefPerson"
      }
    },
    "shoot_window": {
      "anyOf": [
        {
          "$ref": "#/$defs/BriefShootWindow"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "format",
    "title",
    "target_runtime_ms",
    "profile"
  ],
  "additionalProperties": false,
  "$defs": {
    "AspectRatio": {
      "type": "string",
      "description": "The picture shape the work is delivered in.",
      "enum": [
        "9:16",
        "16:9",
        "1:1",
        "4:5"
      ]
    },
    "BriefCharacter": {
      "type": "object",
      "description": "A person or being the story needs. The plan's id for them is made from the name (upper case, letters and digits, other characters as underscores).",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "\\S"
        },
        "description": {
          "description": "Who they are in the story.",
          "type": "string"
        }
      },
      "required": [
        "name",
        "description"
      ],
      "additionalProperties": false
    },
    "BriefDelivery": {
      "type": "object",
      "description": "Short profile: where the work is posted. The picture shape follows from a known platform when aspect is left out.",
      "properties": {
        "platform": {
          "type": [
            "string",
            "null"
          ]
        },
        "aspect": {
          "anyOf": [
            {
              "$ref": "#/$defs/AspectRatio"
            },
            {
              "type": "null"
            }
          ]
        },
        "max_runtime_ms": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "BriefPerson": {
      "type": "object",
      "description": "Short profile: a member of the cast or crew. character names the character they play, by the character's name in this brief.",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "\\S"
        },
        "roles": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PersonRole"
          }
        },
        "character": {
          "type": [
            "string",
            "null"
          ]
        },
        "available": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TimeWindow"
          }
        }
      },
      "required": [
        "name",
        "roles"
      ],
      "additionalProperties": false
    },
    "BriefPlace": {
      "type": "object",
      "description": "A place the story happens in. The plan's id for it is made from the name in the same way as a character's.",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "\\S"
        },
        "description": {
          "type": "string"
        },
        "setting": {
          "description": "Short profile: indoors or outdoors.",
          "anyOf": [
            {
              "$ref": "#/$defs/Setting"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "name",
        "description"
      ],
      "additionalProperties": false
    },
    "BriefProfile": {
      "type": "string",
      "description": "What kind of plan to draft: a film, or a short made on a phone or with a small crew (the short-form profile, DPL_PLAN_FORMAT 2.10).",
      "enum": [
        "film",
        "short"
      ]
    },
    "BriefShootWindow": {
      "type": "object",
      "description": "Short profile: when the shoot happens. One day; the skeleton's schedule has this day.",
      "properties": {
        "date": {
          "description": "YYYY-MM-DD, when it is known.",
          "type": [
            "string",
            "null"
          ],
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "start": {
          "description": "When the day starts (HH:MM).",
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
        },
        "end": {
          "description": "When it ends (HH:MM), after the start.",
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
        }
      },
      "required": [
        "start",
        "end"
      ],
      "additionalProperties": false
    },
    "CameraKind": {
      "type": "string",
      "description": "A phone has lens multipliers (0.5, 1, 3); a camera (mirrorless, DSLR, cinema) has lenses in millimetres.",
      "enum": [
        "phone",
        "camera"
      ]
    },
    "Kit": {
      "type": "object",
      "description": "What the crew has to shoot with.",
      "properties": {
        "cameras": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/KitCamera"
          }
        },
        "supports": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Support"
          }
        },
        "sound": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SoundGear"
          }
        },
        "lights": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LightGear"
          }
        }
      },
      "additionalProperties": false
    },
    "KitCamera": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "$ref": "#/$defs/CameraKind"
        },
        "description": {
          "description": "The device in words (\"iPhone 15\", \"Sony FX3\").",
          "type": [
            "string",
            "null"
          ]
        },
        "lens_multipliers": {
          "description": "For a phone: its lenses as multipliers of the main camera, for example [0.5, 1, 3].",
          "type": "array",
          "items": {
            "type": "number"
          }
        },
        "lenses": {
          "description": "For a camera: its lenses. A prime gives mm; a zoom gives min_mm and max_mm.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/KitLens"
          }
        },
        "crop_factor": {
          "description": "For a camera: the sensor's crop factor against full frame (1 full frame, 1.5 APS-C, 2 Micro Four Thirds).",
          "type": [
            "number",
            "null"
          ]
        },
        "sensor": {
          "description": "For a camera: the sensor in words (\"full frame\", \"Super 35\").",
          "type": [
            "string",
            "null"
          ]
        },
        "frame_rates": {
          "description": "The frame rates it records, in frames per second.",
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      },
      "required": [
        "id",
        "kind"
      ],
      "additionalProperties": false
    },
    "KitLens": {
      "type": "object",
      "properties": {
        "mm": {
          "description": "A prime lens's focal length in millimetres.",
          "type": [
            "number",
            "null"
          ]
        },
        "min_mm": {
          "description": "A zoom's shortest and longest focal length in millimetres.",
          "type": [
            "number",
            "null"
          ]
        },
        "max_mm": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "LightGear": {
      "type": "string",
      "enum": [
        "none",
        "practical",
        "led_panel",
        "reflector"
      ]
    },
    "PersonRole": {
      "type": "string",
      "enum": [
        "talent",
        "camera",
        "sound",
        "director",
        "helper"
      ]
    },
    "Setting": {
      "type": "string",
      "enum": [
        "indoor",
        "outdoor"
      ]
    },
    "SoundGear": {
      "type": "string",
      "enum": [
        "phone_mic",
        "lav",
        "shotgun",
        "recorder"
      ]
    },
    "Support": {
      "type": "string",
      "description": "Where the camera is carried. handheld, shoulder, gimbal and steadicam need an operator holding the camera.",
      "enum": [
        "handheld",
        "gimbal",
        "tripod",
        "clamp",
        "slider",
        "shoulder",
        "dolly",
        "jib",
        "crane",
        "steadicam",
        "drone"
      ]
    },
    "TimeWindow": {
      "type": "object",
      "description": "A span of clock time on a shoot day (\"09:30\" to \"11:00\", 24-hour). Without day it applies on every shoot day.",
      "properties": {
        "day": {
          "description": "The shoot day (a day id of schedule) it applies to.",
          "type": [
            "string",
            "null"
          ]
        },
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        }
      },
      "required": [
        "from",
        "to"
      ],
      "additionalProperties": false
    }
  }
}
