# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Optional

from devplacepy.schemas.base import _Out


class GameCropOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    cost: int = 0
    reward_coins: int = 0
    reward_xp: int = 0
    min_level: int = 1
    min_mastery: int = 0
    grow_seconds: int = 0
    locked: bool = False
    locked_reason: str = ""
    locked_text: str = ""
    market_state: str = "normal"


class GamePlotOut(_Out):
    slot: int = 0
    state: str = "empty"
    crop_key: str = ""
    crop_name: str = ""
    crop_icon: str = ""
    reward_coins: int = 0
    reward_xp: int = 0
    ready_at: str = ""
    remaining_seconds: int = 0
    watered_count: int = 0
    max_waters: int = 0
    can_water: bool = False
    can_steal: bool = False
    steal_coins: int = 0
    steal_cooldown_seconds: int = 0
    steal_reason: str = ""
    is_golden: bool = False
    fertilize_cost: int = 0
    raided_fraction: float = 0.0
    raided_pct: int = 0


class GamePerkOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    description: str = ""
    level: int = 0
    max_level: int = 0
    cost: int = 0
    maxed: bool = False
    effect: str = ""


class GameLegacyOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    description: str = ""
    level: int = 0
    max_level: int = 0
    cost: int = 0
    maxed: bool = False
    effect: str = ""


class GameMasteryOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    description: str = ""
    level: int = 0
    max_level: int = 0
    cost: int = 0
    maxed: bool = False
    effect: str = ""


class GameInfrastructureOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    description: str = ""
    cost: int = 0
    min_prestige: int = 0
    owned: bool = False


class GameCosmeticOut(_Out):
    key: str = ""
    name: str = ""
    icon: str = ""
    description: str = ""
    cost_coins: int = 0
    kind: str = ""
    owned: bool = False


class GameQuestOut(_Out):
    kind: str = ""
    label: str = ""
    goal: int = 0
    progress: int = 0
    reward_coins: int = 0
    reward_xp: int = 0
    claimed: bool = False
    can_claim: bool = False
    scope: str = "daily"
    reward_stars: int = 0


class GameFarmOut(_Out):
    owner_username: str = ""
    owner_uid: str = ""
    is_owner: bool = False
    coins: int = 0
    xp: int = 0
    level: int = 1
    level_into: int = 0
    level_span: int = 0
    level_is_max: bool = False
    total_harvests: int = 0
    plot_count: int = 0
    max_plots: int = 0
    next_plot_cost: int = 0
    ci_tier: int = 1
    ci_label: str = ""
    ci_speed: float = 1.0
    ci_next_tier: int = 0
    ci_next_label: str = ""
    ci_next_cost: int = 0
    plots: list[GamePlotOut] = []
    crops: list[GameCropOut] = []
    prestige: int = 0
    prestige_multiplier: float = 1.0
    prestige_min_level: int = 0
    prestige_available: bool = False
    refactor_cost: int = 0
    refactor_affordable: bool = False
    refactor_carryover_pct: int = 0
    refactor_carryover_preview: int = 0
    grant_available: bool = False
    grant_amount: int = 0
    grant_reason: str = ""
    treasury_balance: int = 0
    streak: int = 0
    daily_available: bool = False
    daily_streak_reset: bool = False
    daily_reward: int = 0
    perks: list[GamePerkOut] = []
    quests: list[GameQuestOut] = []
    stars: int = 0
    legacy: list[GameLegacyOut] = []
    steal_cooldown_seconds: int = 0
    mastery_points: int = 0
    mastery_points_earned_total: int = 0
    mastery: list[GameMasteryOut] = []
    infrastructure: list[GameInfrastructureOut] = []
    defense_level: int = 0
    defense_tier_name: str = ""
    defense_upkeep_daily: int = 0
    defense_next_cost: int = 0
    cosmetics: list[GameCosmeticOut] = []
    active_title: str = ""
    underdog_boost_seconds_remaining: int = 0
    contract_boost_seconds_remaining: int = 0
    auto_harvested: int = 0
    auto_harvest_coins: int = 0
    auto_harvest_xp: int = 0
    steal_max_per_victim_per_day: int = 0
    defense_downgrade_available: bool = False
    mastery_analytics_unlocked: bool = False
    lifetime_coins_earned: int = 0
    lifetime_harvests: int = 0
    harvests_week: int = 0
    era_active: bool = False
    era_name: str = ""
    era_coins: int = 0
    era_harvests: int = 0


class GameStateOut(_Out):
    ok: bool = True
    farm: GameFarmOut
    game_error: Optional[str] = None


class GameFarmViewOut(_Out):
    farm: GameFarmOut
    page_title: str = ""
    meta_description: str = ""
    stole_coins: int = 0
    game_error: Optional[str] = None


class GameLeaderboardEntryOut(_Out):
    rank: int = 0
    username: str = ""
    level: int = 1
    xp: int = 0
    coins: int = 0
    total_harvests: int = 0
    prestige: int = 0
    score: int = 0
    raid_avg: float = 0.0
    time_to_kernel_seconds: int = 0
    title: str = ""


class GameLeaderboardOut(_Out):
    entries: list[GameLeaderboardEntryOut] = []
