# coding: utf-8

"""
    Slack Web API

    One way to interact with the Slack platform is its HTTP RPC-based Web API, a collection of methods requiring OAuth 2.0-based user, bot, or workspace tokens blessed with related OAuth scopes.

    The version of the OpenAPI document: 1.7.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from slack_beta_ti.models.objs_reaction import ObjsReaction
from typing import Optional, Set
from typing_extensions import Self

class ObjsFile(BaseModel):
    """
    ObjsFile
    """ # noqa: E501
    channels: Optional[List[Annotated[str, Field(strict=True)]]] = None
    comments_count: Optional[StrictInt] = None
    created: Optional[StrictInt] = None
    date_delete: Optional[StrictInt] = None
    display_as_bot: Optional[StrictBool] = None
    editable: Optional[StrictBool] = None
    editor: Optional[Annotated[str, Field(strict=True)]] = None
    external_id: Optional[StrictStr] = None
    external_type: Optional[StrictStr] = None
    external_url: Optional[StrictStr] = None
    filetype: Optional[StrictStr] = None
    groups: Optional[List[Annotated[str, Field(strict=True)]]] = None
    has_rich_preview: Optional[StrictBool] = None
    id: Optional[Annotated[str, Field(strict=True)]] = None
    image_exif_rotation: Optional[StrictInt] = None
    ims: Optional[List[Annotated[str, Field(strict=True)]]] = None
    is_external: Optional[StrictBool] = None
    is_public: Optional[StrictBool] = None
    is_starred: Optional[StrictBool] = None
    is_tombstoned: Optional[StrictBool] = None
    last_editor: Optional[Annotated[str, Field(strict=True)]] = None
    mimetype: Optional[StrictStr] = None
    mode: Optional[StrictStr] = None
    name: Optional[StrictStr] = None
    non_owner_editable: Optional[StrictBool] = None
    num_stars: Optional[StrictInt] = None
    original_h: Optional[StrictInt] = None
    original_w: Optional[StrictInt] = None
    permalink: Optional[StrictStr] = None
    permalink_public: Optional[StrictStr] = None
    pinned_info: Optional[Dict[str, Any]] = None
    pinned_to: Optional[List[Annotated[str, Field(strict=True)]]] = None
    pretty_type: Optional[StrictStr] = None
    preview: Optional[StrictStr] = None
    public_url_shared: Optional[StrictBool] = None
    reactions: Optional[List[ObjsReaction]] = None
    shares: Optional[Dict[str, Any]] = None
    size: Optional[StrictInt] = None
    source_team: Optional[Annotated[str, Field(strict=True)]] = None
    state: Optional[StrictStr] = None
    thumb_1024: Optional[StrictStr] = None
    thumb_1024_h: Optional[StrictInt] = None
    thumb_1024_w: Optional[StrictInt] = None
    thumb_160: Optional[StrictStr] = None
    thumb_360: Optional[StrictStr] = None
    thumb_360_h: Optional[StrictInt] = None
    thumb_360_w: Optional[StrictInt] = None
    thumb_480: Optional[StrictStr] = None
    thumb_480_h: Optional[StrictInt] = None
    thumb_480_w: Optional[StrictInt] = None
    thumb_64: Optional[StrictStr] = None
    thumb_720: Optional[StrictStr] = None
    thumb_720_h: Optional[StrictInt] = None
    thumb_720_w: Optional[StrictInt] = None
    thumb_80: Optional[StrictStr] = None
    thumb_800: Optional[StrictStr] = None
    thumb_800_h: Optional[StrictInt] = None
    thumb_800_w: Optional[StrictInt] = None
    thumb_960: Optional[StrictStr] = None
    thumb_960_h: Optional[StrictInt] = None
    thumb_960_w: Optional[StrictInt] = None
    thumb_tiny: Optional[StrictStr] = None
    timestamp: Optional[StrictInt] = None
    title: Optional[StrictStr] = None
    updated: Optional[StrictInt] = None
    url_private: Optional[StrictStr] = None
    url_private_download: Optional[StrictStr] = None
    user: Optional[StrictStr] = None
    user_team: Optional[Annotated[str, Field(strict=True)]] = None
    username: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["channels", "comments_count", "created", "date_delete", "display_as_bot", "editable", "editor", "external_id", "external_type", "external_url", "filetype", "groups", "has_rich_preview", "id", "image_exif_rotation", "ims", "is_external", "is_public", "is_starred", "is_tombstoned", "last_editor", "mimetype", "mode", "name", "non_owner_editable", "num_stars", "original_h", "original_w", "permalink", "permalink_public", "pinned_info", "pinned_to", "pretty_type", "preview", "public_url_shared", "reactions", "shares", "size", "source_team", "state", "thumb_1024", "thumb_1024_h", "thumb_1024_w", "thumb_160", "thumb_360", "thumb_360_h", "thumb_360_w", "thumb_480", "thumb_480_h", "thumb_480_w", "thumb_64", "thumb_720", "thumb_720_h", "thumb_720_w", "thumb_80", "thumb_800", "thumb_800_h", "thumb_800_w", "thumb_960", "thumb_960_h", "thumb_960_w", "thumb_tiny", "timestamp", "title", "updated", "url_private", "url_private_download", "user", "user_team", "username"]

    @field_validator('editor')
    def editor_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^[UW][A-Z0-9]{2,}$", value):
            raise ValueError(r"must validate the regular expression /^[UW][A-Z0-9]{2,}$/")
        return value

    @field_validator('id')
    def id_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^[F][A-Z0-9]{8,}$", value):
            raise ValueError(r"must validate the regular expression /^[F][A-Z0-9]{8,}$/")
        return value

    @field_validator('last_editor')
    def last_editor_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^[UW][A-Z0-9]{2,}$", value):
            raise ValueError(r"must validate the regular expression /^[UW][A-Z0-9]{2,}$/")
        return value

    @field_validator('source_team')
    def source_team_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^[T][A-Z0-9]{2,}$", value):
            raise ValueError(r"must validate the regular expression /^[T][A-Z0-9]{2,}$/")
        return value

    @field_validator('user_team')
    def user_team_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^[T][A-Z0-9]{2,}$", value):
            raise ValueError(r"must validate the regular expression /^[T][A-Z0-9]{2,}$/")
        return value

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of ObjsFile from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in reactions (list)
        _items = []
        if self.reactions:
            for _item_reactions in self.reactions:
                if _item_reactions:
                    _items.append(_item_reactions.to_dict())
            _dict['reactions'] = _items
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of ObjsFile from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "channels": obj.get("channels"),
            "comments_count": obj.get("comments_count"),
            "created": obj.get("created"),
            "date_delete": obj.get("date_delete"),
            "display_as_bot": obj.get("display_as_bot"),
            "editable": obj.get("editable"),
            "editor": obj.get("editor"),
            "external_id": obj.get("external_id"),
            "external_type": obj.get("external_type"),
            "external_url": obj.get("external_url"),
            "filetype": obj.get("filetype"),
            "groups": obj.get("groups"),
            "has_rich_preview": obj.get("has_rich_preview"),
            "id": obj.get("id"),
            "image_exif_rotation": obj.get("image_exif_rotation"),
            "ims": obj.get("ims"),
            "is_external": obj.get("is_external"),
            "is_public": obj.get("is_public"),
            "is_starred": obj.get("is_starred"),
            "is_tombstoned": obj.get("is_tombstoned"),
            "last_editor": obj.get("last_editor"),
            "mimetype": obj.get("mimetype"),
            "mode": obj.get("mode"),
            "name": obj.get("name"),
            "non_owner_editable": obj.get("non_owner_editable"),
            "num_stars": obj.get("num_stars"),
            "original_h": obj.get("original_h"),
            "original_w": obj.get("original_w"),
            "permalink": obj.get("permalink"),
            "permalink_public": obj.get("permalink_public"),
            "pinned_info": obj.get("pinned_info"),
            "pinned_to": obj.get("pinned_to"),
            "pretty_type": obj.get("pretty_type"),
            "preview": obj.get("preview"),
            "public_url_shared": obj.get("public_url_shared"),
            "reactions": [ObjsReaction.from_dict(_item) for _item in obj["reactions"]] if obj.get("reactions") is not None else None,
            "shares": obj.get("shares"),
            "size": obj.get("size"),
            "source_team": obj.get("source_team"),
            "state": obj.get("state"),
            "thumb_1024": obj.get("thumb_1024"),
            "thumb_1024_h": obj.get("thumb_1024_h"),
            "thumb_1024_w": obj.get("thumb_1024_w"),
            "thumb_160": obj.get("thumb_160"),
            "thumb_360": obj.get("thumb_360"),
            "thumb_360_h": obj.get("thumb_360_h"),
            "thumb_360_w": obj.get("thumb_360_w"),
            "thumb_480": obj.get("thumb_480"),
            "thumb_480_h": obj.get("thumb_480_h"),
            "thumb_480_w": obj.get("thumb_480_w"),
            "thumb_64": obj.get("thumb_64"),
            "thumb_720": obj.get("thumb_720"),
            "thumb_720_h": obj.get("thumb_720_h"),
            "thumb_720_w": obj.get("thumb_720_w"),
            "thumb_80": obj.get("thumb_80"),
            "thumb_800": obj.get("thumb_800"),
            "thumb_800_h": obj.get("thumb_800_h"),
            "thumb_800_w": obj.get("thumb_800_w"),
            "thumb_960": obj.get("thumb_960"),
            "thumb_960_h": obj.get("thumb_960_h"),
            "thumb_960_w": obj.get("thumb_960_w"),
            "thumb_tiny": obj.get("thumb_tiny"),
            "timestamp": obj.get("timestamp"),
            "title": obj.get("title"),
            "updated": obj.get("updated"),
            "url_private": obj.get("url_private"),
            "url_private_download": obj.get("url_private_download"),
            "user": obj.get("user"),
            "user_team": obj.get("user_team"),
            "username": obj.get("username")
        })
        return _obj


