import typing as _typing

import dynamix_sdk.base as _base
import dynamix_sdk.api._nested as _nested
from dynamix_sdk.utils import EmptyStr as _EmptyStr


class CloudapiImageGetResultModel(_base.BaseAPIResultModel):
    account_id: int
    acl: list[_typing.Any]
    arch: str
    boot_mode: _nested.BootMode | _EmptyStr | None
    bootable: bool
    cd_presented_to: dict[str, list[int]]
    deleted_timestamp: int
    description: str
    drivers: list[_nested.Driver]
    enabled: bool
    grid_id: int
    guid: int
    history: list[_nested.ImageHistoryRecordAPIResultNM]
    hot_resize: bool
    id: int
    independent: bool
    last_modified: int
    link_to: int
    links_to: list[int] | None = None
    milestones: int
    name: str
    network_interface_naming: _nested.NetIfaceNamingTemplate
    os_password: str | None
    os_user_name: str | None
    present_to: dict[str, int]
    provider_name: str
    purge_attempt_count: int
    res_id: str | None
    rescue_cd: bool
    sep_id: int
    sep_pool_name: str
    storage_policy_id: int
    shared_with: list[int]
    size_gb: int
    snapshot_id: str = ''
    status: _nested.ImageStatus
    tech_status: _nested.ImageTechStatus
    to_clean: bool
    type: _nested.ImageType
    unc_path: str
    version: str
    vm_ci_id: int

    @_base.computed_field
    def boot_loader_type(self) -> _nested.BootLoaderType | None:
        if self.type in _nested.BootLoaderType._member_names_:
            return _nested.BootLoaderType[self.type]

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


class CloudapiImageGetProtocol(_base.BasePostAPIFunctionProtocol):
    def get(
        self,
        *,
        image_id: int,
        show_all: bool = False,
    ) -> CloudapiImageGetResultModel:
        ...
