{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://shapes.penny.coop/publication/1.0.0/schema.json",
  "title": "Publication",
  "description": "A research publication with title, slug, authors, Content, attachments and publication settings.",
  "type": "object",
  "properties": {
    "title": {
      "title": "Title",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text"
      }
    },
    "slug": {
      "title": "Slug",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text"
      }
    },
    "authors": {
      "title": "Authors",
      "type": "array",
      "items": {
        "type": "string",
        "description": "A project-local record reference, normally typeName/recordId. The referenced record is not embedded."
      },
      "x-penny": {
        "field": "reference",
        "to": [
          "contact"
        ],
        "multiple": true
      }
    },
    "excerpt": {
      "title": "Excerpt",
      "type": "string",
      "x-penny": {
        "field": "textarea",
        "input": "textarea"
      }
    },
    "content": {
      "title": "Content",
      "$ref": "https://shapes.penny.coop/content-markdown/1.0.0/schema.json",
      "x-penny": {
        "field": "content",
        "storage": "markdown"
      }
    },
    "coverImage": {
      "title": "Cover Image",
      "type": "object",
      "properties": {
        "ref": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "ref"
      ],
      "description": "A project-local media reference; the file bytes and access permissions are stored separately.",
      "x-penny": {
        "field": "image"
      }
    },
    "uploads": {
      "title": "Files",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "number",
            "minimum": 0
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "key"
        ]
      },
      "x-penny": {
        "field": "files"
      }
    },
    "status": {
      "title": "Status",
      "type": "string",
      "enum": [
        "draft",
        "published",
        "archived"
      ],
      "x-penny": {
        "field": "text",
        "input": "select",
        "options": [
          "draft",
          "published",
          "archived"
        ]
      }
    },
    "publishedAt": {
      "title": "Published At",
      "type": "string",
      "format": "date",
      "x-penny": {
        "field": "date",
        "input": "date"
      }
    }
  },
  "required": [
    "title",
    "slug"
  ],
  "x-penny": {
    "shape": "publication",
    "version": "1.0.0",
    "source": "app/types/publication.js",
    "sourceName": "publication",
    "kind": "record",
    "plural": "Publications",
    "icon": "BookOpen",
    "group": "Public",
    "defaultVisibility": "private",
    "publishable": true,
    "fieldOrder": [
      "title",
      "slug",
      "authors",
      "excerpt",
      "content",
      "coverImage",
      "uploads",
      "status",
      "publishedAt"
    ]
  }
}
