# generated by datamodel-codegen:
#   filename:  property/property_feature_definition.json
#   timestamp: 2026-02-23T01:56:40+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated

from adcp.types.base import AdCPBaseModel
from pydantic import AnyUrl, ConfigDict, Field

from ..core import ext as ext_1


class Coverage(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    countries: Annotated[
        list[str] | None, Field(description='Countries where this feature is available')
    ] = None
    property_types: Annotated[
        list[str] | None, Field(description='Property types this feature applies to')
    ] = None


class Range(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    max: Annotated[float, Field(description='Maximum value')]
    min: Annotated[float, Field(description='Minimum value')]


class Type(Enum):
    binary = 'binary'
    quantitative = 'quantitative'
    categorical = 'categorical'


class PropertyFeatureDefinition(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    allowed_values: Annotated[
        list[str] | None, Field(description='For categorical features, the set of valid values')
    ] = None
    coverage: Annotated[
        Coverage | None, Field(description='What this feature covers (empty arrays = all)')
    ] = None
    description: Annotated[
        str | None, Field(description='Description of what this feature measures or represents')
    ] = None
    ext: ext_1.ExtensionObject | None = None
    feature_id: Annotated[
        str,
        Field(
            description="Unique identifier for this feature (e.g., 'consent_quality', 'carbon_score', 'coppa_certified')"
        ),
    ]
    methodology_url: Annotated[
        AnyUrl,
        Field(
            description='URL to documentation explaining how this feature is calculated/measured'
        ),
    ]
    methodology_version: Annotated[
        str | None, Field(description='Version identifier for the methodology (for audit trails)')
    ] = None
    name: Annotated[str, Field(description='Human-readable name for the feature')]
    range: Annotated[
        Range | None, Field(description='For quantitative features, the valid range of values')
    ] = None
    type: Annotated[
        Type,
        Field(
            description='The type of values this feature produces: binary (true/false), quantitative (numeric range), categorical (enumerated values)'
        ),
    ]
