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


class CloudapiDisksGetResultModel(_base.BaseAPIResultModel):
    account_id: int
    account_name: str
    acl: dict
    blkdiscard: bool
    block_size: _nested.DiskBlockSize
    cache_mode: _nested.DiskCacheMode
    created_by: str
    created_timestamp: int
    deleted_by: str
    deleted_timestamp: int
    description: str
    destruction_timestamp: int
    device_name: str | None = None
    grid_id: int
    id: int
    image_id: int
    image_ids: list[int]
    independent: bool
    io_tune: _nested.IOTuneAPIResultNM
    milestones: int
    name: str
    params: str
    parent_id: int
    present_to: dict[str, int]
    provision: _nested.DiskProvisionType
    purge_timestamp: int
    replication: _nested.ReplicationAPIResultNM | dict
    res_id: str
    res_name: str
    role: str
    sep_id: int
    sep_pool_name: str
    sep_type: _nested.SEPType
    shared: bool
    size_available_gb: float
    size_max_gb: int
    size_used_gb: float
    snapshots: list[_nested.SnapshotAPIResultNM]
    status: _nested.DiskStatus
    storage_policy_id: int
    tech_status: _nested.DiskTechStatus
    to_clean: bool
    updated_by: str
    vm_id: int | None
    vm_name: str | None
    vms: dict[str, str]
    updated_timestamp: int = 0

    @_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 destruction_datetime(self) -> _base.datetime | None:
        return self._get_datetime_from_timestamp(self.destruction_timestamp)

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

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


class CloudapiDisksGetProtocol(_base.BasePostAPIFunctionProtocol):
    def get(
        self,
        *,
        disk_id: int,
    ) -> CloudapiDisksGetResultModel: ...
