{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://shapes.penny.coop/contact/1.0.0/schema.json",
  "title": "Contact",
  "description": "A person or organisation with a name, role, biography and image.",
  "type": "object",
  "properties": {
    "contactType": {
      "title": "Type",
      "type": "string",
      "enum": [
        "Person",
        "Organisation"
      ],
      "x-penny": {
        "field": "text",
        "input": "radio",
        "options": [
          "Person",
          "Organisation"
        ]
      }
    },
    "name": {
      "title": "Name",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text"
      }
    },
    "slug": {
      "title": "Slug",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text"
      }
    },
    "organisation": {
      "title": "Organisation",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text",
        "hiddenWhen": {
          "field": "contactType",
          "equals": "Organisation"
        }
      }
    },
    "role": {
      "title": "Role",
      "type": "string",
      "x-penny": {
        "field": "text",
        "input": "text",
        "hiddenWhen": {
          "field": "contactType",
          "equals": "Organisation"
        }
      }
    },
    "bio": {
      "title": "Bio",
      "type": "string",
      "x-penny": {
        "field": "textarea",
        "input": "textarea"
      }
    },
    "avatar": {
      "title": "Photo",
      "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",
        "labelWhen": {
          "field": "contactType",
          "equals": "Organisation",
          "label": "Logo"
        }
      }
    }
  },
  "required": [
    "contactType",
    "name"
  ],
  "x-penny": {
    "shape": "contact",
    "version": "1.0.0",
    "source": "app/types/contact.js",
    "sourceName": "contact",
    "kind": "record",
    "plural": "Contacts",
    "icon": "UserCircle",
    "group": "Public",
    "defaultVisibility": "private",
    "publishable": true,
    "listSubtitle": "organisation",
    "fieldOrder": [
      "contactType",
      "name",
      "slug",
      "organisation",
      "role",
      "bio",
      "avatar"
    ]
  }
}
