site_url: https://theop-io-static.netlify.app

backend:
  name: github # Require a GitHub account
  repo: theop-io/theop-io-static
  branch: main

media_folder: "src/uploads" # Shouldn't use this but it's required, so sure. Relative to the repository root.
public_folder: "/uploads"

collections:
  - name: "tags" # Used in routes
    # How it's presented in the admin UI
    label: "Tags"
    label_singular: "Tag"
    editor:
      preview: false # Our previews are useless/non-existent so just suppress them

    files:
      - name: "shot-tags"
        # How it's presented in the admin UI
        label: "Shot Tags"

        # How it's stored
        file: "src/the-shots/data/the-shots-tags.json"
        format: "json"

        # Fields
        fields:
          - name: "shot-tags"
            label: "Tags"
            label_singular: "Tag"
            description: "List of shot tags"
            widget: "list"
            fields:
              - name: "shot-tag"
                label: "Shot tag"
                widget: "string"

  - name: "the-shots" # Used in routes
    # How it's presented in the admin UI
    label: "The Shots"
    label_singular: "Production"
    summary: "{{productionName}} [{{status}}]"
    editor:
      preview: false # Our previews are useless/non-existent so just suppress them

    sortable_fields: ["productionName", "operatorName", "status"]

    view_groups:
      - label: Operator
        field: operatorName
      - label: Published vs. Draft
        field: status

    # How it's stored
    folder: "src/the-shots/data/shots" # Relative to repository root
    format: "json" # Store in JSON
    create: true # Allow new documents to be created
    slug: "{{productionName}}"

    # How it's indexed
    identifier_field: "productionName"

    # Fields
    # - NOTE: Keep these in sync with /tools/the-shots-build-tools.ts
    fields:
      - name: "productionName"
        label: "Production Name/Year" # Needs to be unique; hopefully including the year makes it so.
        hint: "e.g. 'The Abyss (1989)'; for TV shows: year of debut, e.g. 'E.R. (1994)'"
        widget: "string"
        pattern:
          [
            '.+\(\d{4}\)',
            "Needs to include four-digit year in parentheses, e.g. 'The Abyss (1989)'",
          ]

      - name: "status"
        label: "Status"
        widget: "select"
        options:
          - label: "Published"
            value: "published"
          - label: "Draft"
            value: "draft"
        default: "published"
        multiple: false

      - name: "productionImdbLink"
        label: "Production IMDb Link"
        widget: "string"
        pattern:
          [
            '^https:\/\/www\.imdb\.com\/title\/tt\d+',
            "Format like https://www.imdb.com/title/tt0096754[/...whatever]",
          ]
        required: false

      # List of shots
      - name: "shots"
        label: "Shots"
        label_singular: "Shot"
        widget: "list"
        summary: "{{fields.shortDescription}}"
        fields:
          # Operator info
          - name: "operatorName"
            label: "Operator Name"
            widget: "string"
          - name: "secondaryOperatorName"
            label: "Secondary Operator Name"
            widget: "string"
            required: false

          # Optional metadata
          - name: "timestamp"
            label: "Timestamp"
            widget: "string"
            hint: "e.g. '12:45' for 12 minutes 45 seconds in, or '1:45:00' for one hour and 45 minutes in"
            pattern: ['^\d+:(?:\d{2}:)?\d{2}$', "Provide timestamp as min:sec or hour:min:sec"]
            required: false

          - name: "directorName"
            label: "Director Name"
            hint: "e.g. 'James Cameron'"
            widget: "string"
            required: false

          - name: "dpName"
            label: "DP Name"
            hint: "e.g. 'Mikael Salomon'"
            widget: "string"
            required: false

          - name: "episodic"
            label: "TV Show"
            widget: "object"
            summary: "Season {{fields.season}} Episode {{fields.episode}} ({{fields.episode_title}})"
            fields:
              - name: "season"
                label: "Season Number"
                widget: "number"
                value_type: "int"
                required: false
              - name: "episode"
                label: "Episode Number"
                widget: "number"
                value_type: "int"
                required: false
              - name: "episodeTitle"
                label: "Episode Title"
                widget: "string"
                required: false

          - name: "tags"
            label: "Tags"
            widget: "relation"
            required: false

            # What we're referencing from
            collection: "tags"
            file: "shot-tags"
            options_length: 1000 # Show all known tags

            # What value we're referencing
            value_field: "shot-tags.*.shot-tag"
            search_fields: ["shot-tags.*.shot-tag"]

            # How we're allowing ourselves to reference
            multiple: true
            min: 0

          - name: "videoAspectRatio"
            label: "Video aspect ratio"
            widget: "select"
            options: ["4:3", "16:9", "1.85:1", "2.0:1", "2.39:1"]
            default: "16:9"
            required: false

          - name: "videoLink"
            label: "YouTube/Vimeo video link"
            widget: "string"
            hint: "e.g. 'https://vimeo.com/<videoId>', 'https://youtu.be/M1mg0yLDzvU', or 'https://www.youtube.com/watch?v=M1mg0yLDzvU'"
            required: false

          # Content
          - name: "shortDescription"
            label: "Short Description"
            widget: "string"
          - name: "description"
            label: "Description"
            widget: "markdown"

          # Optional additional content
          - name: "operatorComments"
            label: "Operator Comments"
            widget: "markdown"
            required: false
          - name: "equipmentList"
            label: "Equipment"
            widget: "list"
            fields:
              - name: "item"
                label: "Item"
                widget: "markdown"
            required: false

  - name: "the-reels" # Used in routes
    # How it's presented in the admin UI
    label: "The Reels"
    label_singular: "Reel"
    summary: "{{operatorName}}"
    editor:
      preview: false # Our previews are useless/non-existent so just suppress them

    sortable_fields: ["operatorName"]

    # How it's stored
    folder: "src/the-reels/data/reels" # Relative to repository root
    format: "json" # Store in JSON
    create: true # Allow new documents to be created
    slug: "{{operatorName}}"

    # How it's indexed
    identifier_field: "operatorName"

    # Fields
    # - NOTE: Keep these in sync with /tools/the-reels-build-tools.ts
    fields:
      - name: "operatorName"
        label: "Operator name"
        widget: "string"

      - name: "memberships"
        label: "Memberships"
        widget: "select"
        options: ["SOC", "ASC"]
        multiple: true
        required: false

      - name: "operatorActiveSinceYear"
        label: "Operator active since year"
        widget: "number"
        value_type: "int"
        default: 2000
        min: 1900
        max: 2050

      - name: "operatorContactInfo"
        label: "Operator contact info"
        widget: "object"
        fields:
          - name: "email"
            label: "Email address"
            widget: "string"
            required: false

          - name: "instagram"
            label: "Instagram user name"
            widget: "string"
            required: false

          - name: "url"
            label: "Website"
            widget: "string"
            required: false

      - name: "videoAspectRatio"
        label: "Video aspect ratio"
        widget: "select"
        options: ["4:3", "16:9", "1.85:1", "2.0:1", "2.39:1"]
        default: "16:9"
        required: false

      - name: "videoLink"
        label: "YouTube/Vimeo video link"
        widget: "string"
        hint: "e.g. 'https://vimeo.com/<videoId>', 'https://youtu.be/M1mg0yLDzvU', or 'https://www.youtube.com/watch?v=M1mg0yLDzvU'"

  - name: "words" # Used in routes
    # How it's presented in the admin UI
    label: "The Words"
    label_singular: "Word"
    editor:
      preview: false # Our previews are useless/non-existent so just suppress them

    files:
      - name: "the-words"
        # How it's presented in the admin UI
        label: "The Words"

        # How it's stored
        file: "src/the-words/data/the-words.json"
        format: "json"

        # Fields
        fields:
          - name: "the-words"
            label: "The Words"
            label_singular: "Word"
            description: "List of word definitions"
            widget: "list"
            fields:
              - name: "word"
                label: "Word"
                widget: "string"
                hint: 'You can define multiple words at the same time using a ''/'' (like "Upstage/Downstage")'
              - name: "definition"
                label: "Definition"
                widget: "text"
