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


class CloudapiBserviceGetResultModel(_base.BaseAPIResultModel):
    account_id: int
    account_name: str
    base_domain: str
    cpu_count_total: int
    created_by: str
    created_timestamp: int
    deleted_by: str
    deleted_timestamp: int
    disk_size_total_gb: int
    grid_id: int
    groups: list[_nested.BServiceGroupAPIResultNM]
    guid: int
    id: int
    milestones: int
    name: str
    parent_service_id: int
    parent_service_type: str
    ram_size_total_mb: int
    rg_id: int
    rg_name: str
    snapshots: list[_nested.BServiceSnapshotAPIResultNM]
    ssh_public_key: str
    ssh_user_name: str
    status: _nested.BServiceStatus
    tech_status: _nested.BServiceTechStatus
    updated_by: str
    updated_timestamp: int
    user_managed: bool
    vms: list[_nested.BServiceVMAPIResultNM]
    zone_id: int

    @_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 CloudapiBserviceGetProtocol(_base.BasePostAPIFunctionProtocol):
    def get(
        self,
        *,
        bservice_id: int,
    ) -> CloudapiBserviceGetResultModel:
        ...
