{
    "$schema": "https://highvaluedata.net/fair-data-schema/dev",
    "$id": "https://highvaluedata.net/fair-data-schema/dev/examples/enum-to-fair-coded-values",
    "title": "Evolution of Enums to FAIR Coded Values",
    "description": "This example demonstrates various ways to represent categorical data, from standard JSON Schema enums to shared FAIR-annotated response domains mapped to external SKOS ontologies.",
    "type": "object",
    "$defs": {
        "SimpleSharedDomain": {
            "title": "Simple Shared Response Domain",
            "description": "A standard JSON Schema way to associate labels with codes once and reuse them.",
            "type": "integer",
            "oneOf": [
                {
                    "const": 1,
                    "title": "Yes"
                },
                {
                    "const": 2,
                    "title": "No"
                },
                {
                    "const": 9,
                    "title": "Don't know",
                    "fair:sentinel": true
                }
            ]
        },
        "FairSharedDomain": {
            "title": "FAIR Shared Response Domain",
            "description": "An extended domain using FAIR vocabularies for multilingual support and semantic mapping.",
            "type": "integer",
            "oneOf": [
                {
                    "const": 1,
                    "title": "Yes",
                    "fair:label": {
                        "en": "Yes",
                        "fr": "Oui",
                        "de": "Ja"
                    },
                    "fair:conceptRef": "https://www.wikidata.org/wiki/Q231043"
                },
                {
                    "const": 2,
                    "title": "No",
                    "fair:label": {
                        "en": "No",
                        "fr": "Non",
                        "de": "Nein"
                    },
                    "fair:conceptRef": "https://www.wikidata.org/wiki/Q15303"
                }
            ]
        },
        "SkosNutsDomain": {
            "title": "SKOS Mapped NUTS Domain",
            "description": "A domain mapped to an external SKOS ConceptScheme (NUTS Regions).",
            "type": "string",
            "fair:classification": "NUTS Classification",
            "fair:classificationRef": [
                "http://data.europa.eu/nuts"
            ],
            "oneOf": [
                {
                    "const": "BE",
                    "title": "Belgium",
                    "fair:conceptRef": "http://data.europa.eu/nuts/code/BE"
                },
                {
                    "const": "FR",
                    "title": "France",
                    "fair:conceptRef": "http://data.europa.eu/nuts/code/FR"
                },
                {
                    "const": "DE",
                    "title": "Germany",
                    "fair:conceptRef": "http://data.europa.eu/nuts/code/DE"
                }
            ]
        }
    },
    "properties": {
        "standard_enum": {
            "title": "1. Standard Enum",
            "description": "Simplest approach. Validates against a list, but has no place for labels.",
            "type": "string",
            "enum": [
                "red",
                "green",
                "blue"
            ]
        },
        "inline_oneof": {
            "title": "2. Inline oneOf (Standard)",
            "description": "Standard JSON Schema replacement for enum that allows associating a label (title) with each value.",
            "type": "integer",
            "oneOf": [
                {
                    "const": 0,
                    "title": "Low"
                },
                {
                    "const": 5,
                    "title": "Medium"
                },
                {
                    "const": 10,
                    "title": "High"
                }
            ]
        },
        "shared_standard_1": {
            "title": "3a. Shared Domain (Usage 1)",
            "description": "This variable reuses a standard definition. If the domain changes, you only update it once in $defs.",
            "$ref": "#/$defs/SimpleSharedDomain"
        },
        "shared_standard_2": {
            "title": "3b. Shared Domain (Usage 2)",
            "description": "Another variable sharing the exact same codes and labels.",
            "$ref": "#/$defs/SimpleSharedDomain"
        },
        "fair_usage_1": {
            "title": "4a. FAIR Shared Domain (Usage 1)",
            "description": "Uses the FAIR dialect to provide multilingual labels and semantic concept references.",
            "$ref": "#/$defs/FairSharedDomain",
            "fair:label": "Current Satisfaction"
        },
        "fair_usage_2": {
            "title": "4b. FAIR Shared Domain (Usage 2)",
            "description": "The same FAIR domain used in a different context. Note how this property has its own local FAIR label while inheriting the multilingual codes.",
            "$ref": "#/$defs/FairSharedDomain",
            "fair:label": "Future Intent"
        },
        "skos_usage_1": {
            "title": "5a. SKOS External Mapping (Residence)",
            "description": "Variable mapped to an official external SKOS classification (NUTS regions).",
            "$ref": "#/$defs/SkosNutsDomain",
            "fair:label": "Region of Residence"
        },
        "skos_usage_2": {
            "title": "5b. SKOS External Mapping (Birth)",
            "description": "The same official SKOS classification reused for a different variable.",
            "$ref": "#/$defs/SkosNutsDomain",
            "fair:label": "Region of Birth"
        }
    }
}
