"""Pydantic models for topology YAML structure (design doc section 2.2)."""

from __future__ import annotations

from pydantic import BaseModel


class ExtraDisk(BaseModel):
    path: str
    size_gb: int
    bus: str = "virtio"


class NodeSpec(BaseModel):
    name: str
    role: str
    vcpus: int
    memory_mb: int
    ip: str
    extra_disks: list[ExtraDisk] = []


class NetworkSpec(BaseModel):
    name: str
    bridge: str
    subnet: str
    dhcp: bool = False
    rdma: bool = False


class SshSpec(BaseModel):
    key_path: str
    user: str = "root"
    connect_timeout_s: int = 30


class SnapshotDefaults(BaseModel):
    baseline: str | None = None


class TopologySpec(BaseModel):
    cluster_name: str
    base_image: str
    overlay_dir: str
    network: NetworkSpec
    nodes: list[NodeSpec]
    ssh: SshSpec
    snapshots: SnapshotDefaults = SnapshotDefaults()
