admin-panel-backend/utils/clients/gooyal_advertising_client/models/refined_ad_banner.py
2026-06-07 11:34:17 +03:30

125 lines
3.3 KiB
Python

from collections.abc import Mapping
from typing import Any, TypeVar, Union
from uuid import UUID
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from .content_type_enum import ContentTypeEnum
from .state_634_enum import State634Enum
from ..types import UNSET, Unset
T = TypeVar("T", bound="RefinedAdBanner")
@_attrs_define
class RefinedAdBanner:
"""
Attributes:
uuid (UUID):
object_key (str):
filename (str):
state (State634Enum): * `0` - draft
* `1` - ready_for_check
* `2` - Checking
* `9` - Rejected
* `10` - Modified
* `11` - modification_checking
* `12` - modification_rejected
* `18` - stoped
* `19` - unpublished
* `20` - published
* `100` - deleted
url (str):
content_type (Union[Unset, ContentTypeEnum]): * `1` - image
* `2` - voice
* `3` - video
* `4` - document
"""
uuid: UUID
object_key: str
filename: str
state: State634Enum
url: str
content_type: Union[Unset, ContentTypeEnum] = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
uuid = str(self.uuid)
object_key = self.object_key
filename = self.filename
state = self.state.value
url = self.url
content_type: Union[Unset, int] = UNSET
if not isinstance(self.content_type, Unset):
content_type = self.content_type.value
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"uuid": uuid,
"object_key": object_key,
"filename": filename,
"state": state,
"url": url,
}
)
if content_type is not UNSET:
field_dict["content_type"] = content_type
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
uuid = UUID(d.pop("uuid"))
object_key = d.pop("object_key")
filename = d.pop("filename")
state = State634Enum(d.pop("state"))
url = d.pop("url")
_content_type = d.pop("content_type", UNSET)
content_type: Union[Unset, ContentTypeEnum]
if isinstance(_content_type, Unset):
content_type = UNSET
else:
content_type = ContentTypeEnum(_content_type)
refined_ad_banner = cls(
uuid=uuid,
object_key=object_key,
filename=filename,
state=state,
url=url,
content_type=content_type,
)
refined_ad_banner.additional_properties = d
return refined_ad_banner
@property
def additional_keys(self) -> list[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties