import dynamix_sdk.base as _base
import dynamix_sdk.api._nested as _nested


class CloudapiComputeGetResultModel(_base.BaseAPIResultModel):
    account_id: int
    account_name: str
    acl: _nested.VMACLAPIResultNM
    affinity_label: str
    affinity_rules: list[_nested.AffinityRuleAPIResultNM]
    affinity_weight: int
    anti_affinity_rules: list[_nested.AffinityRuleAPIResultNM]
    arch: str
    auto_start: bool
    boot_disk_size_gb: int
    boot_image_id: int
    boot_loader_metaiso: _nested.BootLoaderMetaisoAPIResultNM | None
    boot_loader_type: _nested.BootLoaderType
    boot_mode: _nested.BootMode
    boot_order: list[_nested.BootDevice]
    cdrom_image_id: int
    chipset: _nested.Chipset
    ci_user_data: dict
    clone_ids: list[int]
    clone_reference: int
    cpu_count: int
    cpu_pin: bool
    created_by: str
    created_timestamp: int
    custom_fields: dict
    deleted_by: str
    deleted_timestamp: int
    description: str
    pci_devices: dict[str, int]
    disks: list[_nested.DiskForCAComputeGetAPIResultNM]
    driver: _nested.Driver
    grid_id: int
    guid: int
    hot_resize: bool
    hp_backed: bool
    id: int
    image_id: None | int
    image_name: None | str
    interfaces: list[_nested.InterfaceForComputeGetAPIResultNM]
    live_migration_job_id: int
    lock_status: _nested.LockStatus
    manager_id: int
    manager_type: str
    migration_job_id: int
    milestones: int
    name: str
    need_reboot: bool
    network_interface_naming: _nested.NetIfaceNamingTemplate
    numa_affinity: _nested.NumaAffinity
    numa_node_id: int
    os_users: list[_nested.OSUserAPIResultNM]
    os_version: str
    pinned_to_node: bool
    preferred_cpu_cores: list[int]
    ram_size_mb: int
    read_only: bool
    reference_id: str
    res_name: str
    reserved_cpu_cores: list[int]
    rg_id: int
    rg_name: str
    snapshot_sets: list[_nested.SnapshotSetAPIResultNM]
    stateless_sep_id: int | None = None
    stateless_sep_type: str | None = None
    status: _nested.VMStatus
    tags: dict
    tech_status: _nested.VMTechStatus
    updated_by: str
    updated_timestamp: int
    user_managed: bool
    vgpus: list[_nested.VGPUAPIResultNM]
    vm_ci_id: int
    vnc_password: str
    guest_agent: _nested.GuestAgentAPIResultNM
    weight: int
    zone_id: int

    natable_vins_id: int = 0
    natable_vins_ip: str = ''
    natable_vins_name: str = ''
    natable_vins_network: str = ''
    natable_vins_network_name: str = ''

    @_base.computed_field
    def created_datetime(self) -> _base.datetime | None:
        return self._get_datetime_from_timestamp(self.created_timestamp)

    @_base.computed_field
    def deleted_datetime(self) -> _base.datetime | None:
        return self._get_datetime_from_timestamp(self.deleted_timestamp)

    @_base.computed_field
    def updated_datetime(self) -> _base.datetime | None:
        return self._get_datetime_from_timestamp(self.updated_timestamp)


class CloudapiComputeGetProtocol(_base.BasePostAPIFunctionProtocol):
    def get(
        self,
        *,
        vm_id: int,
    ) -> CloudapiComputeGetResultModel:
        ...
