"""Mirrors upstream src/2024/schemas/5e-SRD-Levels.ts."""

from pydantic import Field

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


class SneakAttack(SRDModel):
    dice_count: int
    dice_value: int


class ClassSpecific(SRDModel):
    bardic_inspiration_die: int | None = None
    channel_divinity_charges: int | None = None
    eldritch_invocations: int | None = None
    favored_enemies: int | None = None
    focus_points: int | None = None
    martial_arts_die: int | None = None
    rage_count: int | None = None
    rage_damage_bonus: int | None = None
    second_wind_uses: int | None = None
    sneak_attack: SneakAttack | None = None
    sorcery_points: int | None = None
    unarmored_movement_bonus: int | None = None
    weapon_mastery: int | None = None
    wild_shape_uses: int | None = None


class LevelSpellcasting(SRDModel):
    cantrips_known: int | None = None
    prepared_spells: int | None = None
    spell_slots_level_1: int
    spell_slots_level_2: int
    spell_slots_level_3: int
    spell_slots_level_4: int
    spell_slots_level_5: int
    spell_slots_level_6: int | None = None
    spell_slots_level_7: int | None = None
    spell_slots_level_8: int | None = None
    spell_slots_level_9: int | None = None


class Level(SRDModel):
    index: str
    name: str
    level: int
    prof_bonus: int | None = None
    features: list[APIReference] | None = None
    class_: APIReference = Field(alias="class")
    subclass: APIReference | None = None
    class_specific: ClassSpecific | None = None
    spellcasting: LevelSpellcasting | None = None
    url: str
