{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modoboa/json-schema/modoboa-contact-schema.json",
  "title": "Contact",
  "description": "Contact serializer.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/modoboa-contacts-api-openapi.yml#/components/schemas/Contact",
  "type": "object",
  "properties": {
    "pk": {
      "type": "integer",
      "readOnly": true,
      "title": "ID"
    },
    "first_name": {
      "type": "string",
      "maxLength": 30
    },
    "last_name": {
      "type": "string",
      "maxLength": 30
    },
    "categories": {
      "type": "array",
      "items": {
        "type": "integer"
      }
    },
    "emails": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailAddress"
      }
    },
    "phone_numbers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PhoneNumber"
      }
    },
    "company": {
      "type": "string",
      "maxLength": 100
    },
    "position": {
      "type": "string",
      "maxLength": 200
    },
    "address": {
      "type": "string"
    },
    "zipcode": {
      "type": "string",
      "maxLength": 15
    },
    "city": {
      "type": "string",
      "maxLength": 100
    },
    "country": {
      "type": "string",
      "maxLength": 100
    },
    "state": {
      "type": "string",
      "maxLength": 100
    },
    "note": {
      "type": "string"
    },
    "birth_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "display_name": {
      "type": "string",
      "maxLength": 60
    }
  },
  "required": [
    "emails",
    "pk"
  ],
  "$defs": {
    "EmailAddress": {
      "type": "object",
      "description": "Email address serializer.",
      "properties": {
        "pk": {
          "type": "integer",
          "readOnly": true,
          "title": "ID"
        },
        "address": {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        "type": {
          "$ref": "#/$defs/TypeE1dEnum"
        }
      },
      "required": [
        "address",
        "pk",
        "type"
      ]
    },
    "PhoneNumber": {
      "type": "object",
      "description": "Phone number serializer.",
      "properties": {
        "pk": {
          "type": "integer",
          "readOnly": true,
          "title": "ID"
        },
        "number": {
          "type": "string",
          "maxLength": 40
        },
        "type": {
          "$ref": "#/$defs/PhoneNumberTypeEnum"
        }
      },
      "required": [
        "number",
        "pk",
        "type"
      ]
    },
    "PhoneNumberTypeEnum": {
      "enum": [
        "home",
        "work",
        "other",
        "main",
        "cell",
        "fax",
        "pager"
      ],
      "type": "string",
      "description": "* `home` - Home\n* `work` - Work\n* `other` - Other\n* `main` - Main\n* `cell` - Cellular\n* `fax` - Fax\n* `pager` - Pager"
    },
    "TypeE1dEnum": {
      "enum": [
        "home",
        "work",
        "other"
      ],
      "type": "string",
      "description": "* `home` - Home\n* `work` - Work\n* `other` - Other"
    }
  }
}