# retoor <retoor@molodetz.nl>

from __future__ import annotations

import json
from datetime import datetime, timedelta, timezone

from devplacepy.database import get_table
from devplacepy.utils import generate_uid

from .. import economy
from .actions import (
    _auto_harvest,
    boost_flags,
    claim_daily,
    claim_quest,
    fertilize,
    harvest,
    plant,
    prestige,
    steal,
    upgrade_legacy,
    upgrade_perk,
    water,
)
from .common import (
    GameError,
    PERK_COLUMN,
    _farms,
    _iso,
    _iso_week,
    _lvl,
    _now,
    _parse,
    _parse_date,
    _plots,
    _quests,
    _steals,
    _today,
    _update_farm,
    clear_plot,
    conditional_update_farm,
    conditional_update_row,
    credit_farm,
    last_steal_at,
    next_streak,
    raids_against_today,
    refund_farm,
    steal_cooldown_remaining,
)
from .cosmetics import buy_cosmetic, equip_title, owned_cosmetic_keys
from .defense import charge_upkeep, downgrade_defense, upgrade_defense
from .era import active_era, active_era_name, end_era, start_era
from .farm import (
    _create_plot,
    _plot_at,
    buy_plot,
    ensure_farm,
    get_farm,
    get_plots,
    leaderboard,
    leaderboard_for,
    upgrade_ci,
)
from .infrastructure import buy_infrastructure, owns_infrastructure
from .market import market_factor_for, prune_steals, prune_ticks, recent_harvests
from .mastery import upgrade_mastery
from .quests import advance_quests, ensure_quests
from .treasury import (
    claim_grant,
    eligible_grant_farms,
    ensure_treasury,
    grant_status,
    treasury_balance,
)
from .serialize import (
    _daily_available,
    _plot_state,
    _serialize_legacy,
    _serialize_perks,
    _serialize_quests,
    _watered_by,
    serialize_farm,
    serialize_plot,
)
