{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://vizai.io/schema/entity-profile/v1.0",
  "title": "VizAI Entity Profile",
  "description": "Canonical public entity profile. Exactly one profile is published per business at registry/<entity-slug>/profile.json. The artifact contains only information approved for public release and never contains private evidence, intake records, or internal workflow data.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "entitySlug",
    "businessIdentifier",
    "category",
    "verification",
    "metadata"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1.0"
    },
    "entitySlug": {
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "description": "Canonical unique key matching the registry/<entity-slug>/ directory."
    },
    "businessIdentifier": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "legalName",
        "commonName",
        "primaryDomain"
      ],
      "properties": {
        "legalName": {
          "type": "string"
        },
        "commonName": {
          "type": "string"
        },
        "primaryDomain": {
          "type": "string",
          "format": "hostname"
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "category": {
      "type": "string",
      "description": "Primary discovery category.",
      "enum": [
        "technology",
        "professional-services",
        "financial",
        "healthcare",
        "manufacturing",
        "retail",
        "construction",
        "hospitality",
        "transportation",
        "logistics",
        "education",
        "real-estate",
        "other"
      ]
    },
    "verification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "method",
        "lastVerified"
      ],
      "properties": {
        "status": {
          "type": "string",
          "description": "Public verification and claim state. Storage and service tiers are not part of the public contract.",
          "enum": [
            "claimed_verified",
            "unclaimed_observed",
            "verification_pending",
            "disputed"
          ]
        },
        "method": {
          "type": "string",
          "enum": [
            "customer-canon-approval",
            "domain-ownership",
            "email-verification",
            "manual-review",
            "public-source-review"
          ]
        },
        "canonVersion": {
          "type": "string",
          "description": "Private source-canon version identifier for claimed profiles."
        },
        "customerApprovalDate": {
          "type": "string",
          "format": "date"
        },
        "lastVerified": {
          "type": "string",
          "format": "date"
        },
        "qualityScore": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "claimed_verified"
              }
            }
          },
          "then": {
            "required": [
              "canonVersion"
            ]
          }
        }
      ]
    },
    "profileVersion": {
      "type": "integer",
      "minimum": 1,
      "description": "Monotonically increasing public profile version."
    },
    "profile": {
      "type": "object",
      "additionalProperties": false,
      "description": "Approved public business facts.",
      "properties": {
        "businessType": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "yearFounded": {
          "type": "integer"
        },
        "ownership": {
          "type": "string"
        },
        "scale": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "facilityCount": {
              "type": "integer"
            },
            "totalSquareFeet": {
              "type": "string"
            },
            "locationCount": {
              "type": "integer"
            },
            "region": {
              "type": "string"
            }
          }
        },
        "locations": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "role": {
                "type": "string"
              }
            }
          }
        },
        "services": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "industriesServed": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "claims": {
          "type": "array",
          "description": "Approved public non-credential claims.",
          "items": {
            "type": "string"
          }
        },
        "contact": {
          "type": "object",
          "additionalProperties": false,
          "description": "Public business contact points approved for publication.",
          "properties": {
            "phone": {
              "type": "string"
            },
            "tollFree": {
              "type": "string"
            },
            "email": {
              "type": "string",
              "format": "email"
            },
            "website": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "profiles": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "linkedin": {
              "type": "string",
              "format": "uri"
            },
            "facebook": {
              "type": "string",
              "format": "uri"
            },
            "twitter": {
              "type": "string"
            },
            "crunchbase": {
              "type": "string"
            },
            "bbb": {
              "type": "string"
            }
          }
        }
      }
    },
    "credentials": {
      "type": "array",
      "description": "Evidence-verified claims cleared for public publication.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "evidenceStatus",
          "publicPublishAllowed"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "credentialType": {
            "type": "string",
            "enum": [
              "certification",
              "award",
              "license",
              "regulated-credential",
              "security-designation",
              "compliance",
              "membership",
              "accreditation",
              "safety-quality-program",
              "partner-vendor-status",
              "recognition"
            ]
          },
          "issuingBody": {
            "type": "string"
          },
          "issueDate": {
            "type": "string",
            "format": "date"
          },
          "expiryOrRenewalDate": {
            "type": "string",
            "format": "date"
          },
          "evidenceStatus": {
            "const": "evidence_verified"
          },
          "publicPublishAllowed": {
            "const": true
          }
        }
      }
    },
    "metadata": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "dateAdded",
        "lastUpdated"
      ],
      "properties": {
        "dateAdded": {
          "type": "string",
          "format": "date"
        },
        "lastUpdated": {
          "type": "string",
          "format": "date"
        }
      }
    }
  }
}
