from ...sync_system.strategy import DefaultSyncStrategy
from ...sync_system.config import StrategyConfig, OrphanAction, UpdateDirection
from schemas.project_extensions.generator_unit import GeneratorUnitProject


class UnitsSyncStrategy(DefaultSyncStrategy[GeneratorUnitProject]):
    """
    Units 同步策略（项目扩展）。
    """

    schema = GeneratorUnitProject

    default_config = StrategyConfig(
        auto_bind=True,
        auto_bind_fields=["project_id", "serial_number"],
        depend_fields={"project_id": "project"},
        local_orphan_action=OrphanAction.NONE,
        remote_orphan_action=OrphanAction.NONE,
        update_direction=UpdateDirection.PUSH,
    )