# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Optional

from devplacepy.schemas.base import _Out


class WarPersonOut(_Out):
    uid: str = ""
    username: str = ""
    avatar_seed: Optional[str] = None
    level: int = 1


class WarContributorOut(WarPersonOut):
    faction: str = ""
    hp: int = 0


class WarEventOut(_Out):
    seq: int = 0
    kind: str = ""
    message: str = ""
    faction: str = ""
    created_at: str = ""
    hp_a: Optional[int] = None
    hp_b: Optional[int] = None
    damage: Optional[int] = None
    winner: Optional[str] = None


class WarViewerOut(_Out):
    faction: str = ""
    hp: int = 0
    rank: int = 0
    fight_count: int = 0
    last_fight_at: str = ""
    next_fight_at: str = ""
    can_fight: bool = False


class WarOut(_Out):
    uid: str = ""
    post_uid: str = ""
    post_url: str = ""
    post_title: str = ""
    author: Optional[WarPersonOut] = None
    faction_a: str = ""
    faction_b: str = ""
    hp_a: int = 0
    hp_b: int = 0
    pct_a: int = 50
    pct_b: int = 50
    leader: str = ""
    fighter_count: int = 0
    status: str = "active"
    winner: str = ""
    winner_label: str = ""
    created_at: str = ""
    ends_at: str = ""
    ends_in: str = ""
    resolved_at: str = ""
    last_seq: int = 0
    fight_cost: int = 0
    top_contributors: list[WarContributorOut] = []
    recent_events: list[WarEventOut] = []
    viewer: Optional[WarViewerOut] = None


class BattlesOut(_Out):
    battles: list[WarOut] = []
    current_filter: str = "active"
    counts: dict = {}
    search: str = ""
    pagination: dict = {}


class WarEventsOut(_Out):
    events: list[WarEventOut] = []
    status: str = ""
