{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/open-equine/equine-data-standard/main/equine-profile-standard/v1.0/schema/equine.profile.standard.v1.0.json",
  "title": "Equine Profile Standard",
  "description": "An open, MIT licensed JSON schema defining how equine profile data should be structured for digital identity, AI indexing, and global interoperability. Published by Open Equine — TechXZone Pvt Ltd. openequine.org.",
  "version": "1.0",
  "type": "object",

  "required": ["horseName", "dob", "breed", "gender", "color", "meta"],

  "properties": {

    "horseName": {
      "type": "string",
      "minLength": 1,
      "description": "The horse's registered or commonly known name."
    },

    "dob": {
      "type": "string",
      "format": "date",
      "description": "Date of birth in ISO 8601 format: YYYY-MM-DD."
    },

    "breed": {
      "type": "string",
      "minLength": 1,
      "description": "Breed name of the horse. Examples: Marwari, Thoroughbred, Arabian, Warmblood."
    },

    "gender": {
      "type": "string",
      "enum": ["mare", "stallion", "gelding"],
      "description": "Biological sex or reproductive status of the horse."
    },

    "color": {
      "type": "string",
      "minLength": 1,
      "description": "Coat color of the horse. Examples: Bay, Chestnut, Grey, Black, Roan."
    },

    "ueln": {
      "type": "string",
      "pattern": "^[A-Z0-9]{15}$",
      "description": "Universal Equine Life Number — 15-character alphanumeric international unique identifier assigned at birth."
    },

    "passportNo": {
      "type": "string",
      "minLength": 1,
      "description": "Official equine passport number issued by a recognised breed society, national authority, or registration body."
    },

    "microchip": {
      "type": "string",
      "pattern": "^[0-9]{15}$",
      "description": "15-digit ISO 11784/11785 compliant microchip identification number implanted in the horse."
    },

    "pedigree": {
      "type": "object",
      "description": "Lineage and bloodline information for the horse.",
      "properties": {
        "sire": {
          "type": "string",
          "description": "Name of the horse's sire (father)."
        },
        "dam": {
          "type": "string",
          "description": "Name of the horse's dam (mother)."
        },
        "sireOfSire": {
          "type": "string",
          "description": "Paternal grandsire — father of the sire."
        },
        "damOfSire": {
          "type": "string",
          "description": "Paternal granddam — mother of the sire."
        },
        "sireOfDam": {
          "type": "string",
          "description": "Maternal grandsire — father of the dam."
        },
        "damOfDam": {
          "type": "string",
          "description": "Maternal granddam — mother of the dam."
        },
        "description": {
          "type": "string",
          "description": "Free text field for extended lineage notes, great-grandparents, bloodline achievements, or additional pedigree context."
        }
      },
      "additionalProperties": false
    },

    "owner": {
      "type": "object",
      "description": "Current ownership and stable information.",
      "required": ["ownerName", "ownerContact", "stableLocation"],
      "properties": {
        "ownerName": {
          "type": "string",
          "minLength": 1,
          "description": "Full name of the current registered owner of the horse."
        },
        "ownerContact": {
          "type": "string",
          "minLength": 1,
          "description": "Owner's primary contact — phone number or email address."
        },
        "stableLocation": {
          "type": "string",
          "minLength": 1,
          "description": "Name and/or physical location of the stable where the horse is currently kept."
        },
        "breederName": {
          "type": "string",
          "description": "Full name of the person or organisation that bred the horse."
        },
        "breederContact": {
          "type": "string",
          "description": "Breeder's contact — phone number or email address."
        }
      },
      "additionalProperties": false
    },

    "media": {
      "type": "object",
      "description": "Visual media assets associated with the horse profile.",
      "properties": {
        "photos": {
          "type": "array",
          "description": "Collection of photo objects associated with the horse. No maximum limit — implementing applications may enforce their own limits.",
          "items": {
            "type": "object",
            "required": ["url"],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Publicly accessible URI of the image."
              },
              "caption": {
                "type": "string",
                "description": "Optional descriptive caption for the photo. Examples: Left lateral view, Competition 2024, At stable."
              },
              "isPrimary": {
                "type": "boolean",
                "description": "Marks this photo as the primary profile image. Only one photo in the array should be marked true."
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },

    "meta": {
      "type": "object",
      "description": "Metadata about the data record itself — when it was created, by which system, and which version of the standard it conforms to.",
      "required": ["schemaVersion", "createdAt"],
      "properties": {
        "schemaVersion": {
          "type": "string",
          "description": "Version of the Equine Profile Standard this profile conforms to.",
          "example": "1.0"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 datetime at which this data record was first constructed by the originating application. This is not the horse's date of birth. Set once at record creation and never modified."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 datetime of the most recent modification to this data record."
        },
        "capturedBy": {
          "type": "string",
          "description": "Name or identifier of the person or system that submitted the data."
        },
        "sourceApp": {
          "type": "string",
          "description": "Name or URL of the application that generated this profile."
        },
        "geo": {
          "type": "object",
          "description": "Approximate geographic location at the time of data capture. Requires user permission. Omit if not available or not consented.",
          "required": ["lat", "lng"],
          "properties": {
            "lat": {
              "type": "number",
              "minimum": -90,
              "maximum": 90,
              "description": "Latitude coordinate at time of capture."
            },
            "lng": {
              "type": "number",
              "minimum": -180,
              "maximum": 180,
              "description": "Longitude coordinate at time of capture."
            },
            "accuracyMeters": {
              "type": "number",
              "minimum": 0,
              "description": "GPS accuracy radius in metres."
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },

    "consent": {
      "type": "object",
      "description": "Data sharing acknowledgement and consent record. Optional at schema level — implementing platforms are responsible for meeting their own legal and regulatory obligations around data sharing consent. Strongly recommended for any platform that stores, shares, or publishes horse profile data.",
      "properties": {
        "acknowledged": {
          "type": "boolean",
          "description": "Confirms that the submitting party has acknowledged the data accuracy disclaimer and consented to data sharing."
        },
        "acknowledgedAt": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 datetime at which the acknowledgement was given."
        },
        "acknowledgedBy": {
          "type": "string",
          "description": "Full name of the person who gave the acknowledgement — typically the owner."
        },
        "disclaimer": {
          "type": "string",
          "description": "The exact disclaimer text that was shown to the user at the time of acknowledgement."
        },
        "ipAddress": {
          "type": "string",
          "description": "IP address of the submitting device at the time of consent, for audit trail purposes."
        }
      },
      "additionalProperties": false
    }

  },

  "additionalProperties": false
}
