{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "definitions": {
        "string_limit": {
            "maxLength": 1000
        },
        "country_code": {
            "pattern": "^[A-Z]{2}(-[A-Z0-9]{1,3})?$"
        },
        "id": {
            "maxLength": 1000,
            "pattern": "^[a-z0-9+]+(_[a-z0-9+]+)*$"
        },
        "logo": {
            "pattern": "^logo\\.(png|jpg|svg)$"
        }
    },
    "properties": {
        "uuid": {
            "type": "string",
            "title": "UUID",
            "description": "Canonical UUID (UUIDv4), assigned automatically by CI on merge. Leave empty when creating.",
            "readOnly": true,
            "pattern": "^$|^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
        },
        "moved_from": {
            "type": "array",
            "title": "Moved From",
            "description": "Former canonical UUIDv4(s) this entity previously had (before a merge or move). Lets old UUID references resolve here. Managed by tooling/CI — leave empty when creating.",
            "readOnly": true,
            "items": {
                "type": "string",
                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
        },
        "id": {
            "type": "string",
            "title": "ID",
            "description": "The unique identifier for this store",
            "$ref": "#/definitions/id"
        },
        "name": {
            "type": "string",
            "title": "Name",
            "description": "The name of this store",
            "$ref": "#/definitions/string_limit"
        },
        "storefront_url": {
            "type": "string",
            "title": "Storefront URL",
            "description": "A link to the storefront of this store",
            "x-placeholder": "https://example.com/...",
            "$ref": "#/definitions/string_limit"
        },
        "logo": {
            "type": "string",
            "title": "Logo",
            "description": "The name of the logo file",
            "$ref": "#/definitions/logo"
        },
        "ships_from": {
            "type": [
                "array",
                "string"
            ],
            "title": "Ships From",
            "description": "Countries/regions the store ships from",
            "x-placeholder": "e.g., US",
            "items": {
                "type": "string",
                "$ref": "#/definitions/country_code"
            },
            "$ref": "#/definitions/string_limit"
        },
        "ships_to": {
            "type": [
                "array",
                "string"
            ],
            "title": "Ships To",
            "description": "Countries/regions the store ships to",
            "x-placeholder": "e.g., US",
            "items": {
                "type": "string",
                "$ref": "#/definitions/country_code"
            },
            "$ref": "#/definitions/string_limit"
        },
        "source": {
            "type": "string",
            "description": "The source of the data, like another DB or company",
            "$ref": "#/definitions/string_limit"
        }
    },
    "required": [
        "id",
        "name",
        "storefront_url",
        "logo",
        "ships_from",
        "ships_to"
    ]
}
