from ...sync_system.strategy import DefaultSyncStrategy
from ...sync_system.config import StrategyConfig, OrphanAction, UpdateDirection
from schemas.project_extensions.project_detail import ProjectDetailProject


class ProjectDetailSyncStrategy(DefaultSyncStrategy[ProjectDetailProject]):
    """
    ProjectDetail 同步策略（项目容量信息）。

    默认行为：
    - plan_construction / actual_construction / production → push（本地 → 远程）
    - ensure_production / climb_production / challenge_production → pull（远程 → 本地）
    """

    schema = ProjectDetailProject

    default_config = StrategyConfig(
        auto_bind=True,
        auto_bind_fields=["project_id", "key"],
        depend_fields={"project_id": "project"},
        local_orphan_action=OrphanAction.NONE,
        remote_orphan_action=OrphanAction.NONE,
        update_direction=UpdateDirection.PUSH,
        field_direction_key="key",
        field_direction_overrides={
            "ensure_production": UpdateDirection.PULL,
            "climb_production": UpdateDirection.PULL,
            "challenge_production": UpdateDirection.PULL,
        },
    )
