"""Mirrors upstream src/2014/schemas/5e-SRD-Features.ts."""

from pydantic import Field

from dnd5e_db.models.base import SRDModel
from dnd5e_db.models.common import APIReference, Choice


class FeatureSpecific(SRDModel):
    invocations: list[APIReference] | None = None
    expertise_options: Choice | None = None
    subfeature_options: Choice | None = None
    terrain_type_options: Choice | None = None
    enemy_type_options: Choice | None = None


class FeaturePrerequisite(SRDModel):
    type: str
    level: int | None = None
    feature: str | None = None
    spell: str | None = None


class Feature(SRDModel):
    index: str
    name: str
    level: int
    class_: APIReference | None = Field(default=None, alias="class")
    subclass: APIReference | None = None
    desc: list[str]
    prerequisites: list[FeaturePrerequisite]
    parent: APIReference | None = None
    reference: str | None = None
    feature_specific: FeatureSpecific | None = None
    url: str
