from __future__ import annotations

from typing import List

from pydantic import BaseModel, ConfigDict, Field

from .datasource_config import DataSourceConfig
from .logging_config import LoggingConfig
from .persist_config import PersistConfig
from .strategy_config import StrategyRuntimeConfig


DEFAULT_NODE_TYPES: List[str] = [
    "company",
    "supplier",
    "user",
    "project",
    "contract",
    "contract_change",
    "construction_task",
    "construction_task_detail",
    "material",
    "material_detail",
    "contract_settlement",
    "contract_settlement_detail",
    "personnel",
    "personnel_detail",
    "preparation",
    "production",
    "lar",
    "lar_change",
    "project_detail_data",
    "units",
]


class PipelineRunConfig(BaseModel):
    model_config = ConfigDict(extra="forbid", validate_assignment=True)

    node_types: List[str] = Field(default_factory=lambda: list(DEFAULT_NODE_TYPES))

    local_datasource: DataSourceConfig
    remote_datasource: DataSourceConfig

    strategies: List[StrategyRuntimeConfig] = Field(default_factory=list)
    persist: PersistConfig
    logging: LoggingConfig = Field(default_factory=LoggingConfig)
