# coding: utf-8

"""
    YouTube Data API v3

    The YouTube Data API v3 is an API that provides access to YouTube data, such as videos, playlists, and channels.

    The version of the OpenAPI document: v3
    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
from typing import Any, ClassVar, Dict, List, Optional
from youtube_ti.models.activity_content_details_bulletin import ActivityContentDetailsBulletin
from youtube_ti.models.activity_content_details_channel_item import ActivityContentDetailsChannelItem
from youtube_ti.models.activity_content_details_comment import ActivityContentDetailsComment
from youtube_ti.models.activity_content_details_favorite import ActivityContentDetailsFavorite
from youtube_ti.models.activity_content_details_like import ActivityContentDetailsLike
from youtube_ti.models.activity_content_details_playlist_item import ActivityContentDetailsPlaylistItem
from youtube_ti.models.activity_content_details_promoted_item import ActivityContentDetailsPromotedItem
from youtube_ti.models.activity_content_details_recommendation import ActivityContentDetailsRecommendation
from youtube_ti.models.activity_content_details_social import ActivityContentDetailsSocial
from youtube_ti.models.activity_content_details_subscription import ActivityContentDetailsSubscription
from youtube_ti.models.activity_content_details_upload import ActivityContentDetailsUpload
from typing import Optional, Set
from typing_extensions import Self

class ActivityContentDetails(BaseModel):
    """
    Details about the content of an activity: the video that was shared, the channel that was subscribed to, etc.
    """ # noqa: E501
    bulletin: Optional[ActivityContentDetailsBulletin] = None
    channel_item: Optional[ActivityContentDetailsChannelItem] = Field(default=None, alias="channelItem")
    comment: Optional[ActivityContentDetailsComment] = None
    favorite: Optional[ActivityContentDetailsFavorite] = None
    like: Optional[ActivityContentDetailsLike] = None
    playlist_item: Optional[ActivityContentDetailsPlaylistItem] = Field(default=None, alias="playlistItem")
    promoted_item: Optional[ActivityContentDetailsPromotedItem] = Field(default=None, alias="promotedItem")
    recommendation: Optional[ActivityContentDetailsRecommendation] = None
    social: Optional[ActivityContentDetailsSocial] = None
    subscription: Optional[ActivityContentDetailsSubscription] = None
    upload: Optional[ActivityContentDetailsUpload] = None
    __properties: ClassVar[List[str]] = ["bulletin", "channelItem", "comment", "favorite", "like", "playlistItem", "promotedItem", "recommendation", "social", "subscription", "upload"]

    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 ActivityContentDetails 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 bulletin
        if self.bulletin:
            _dict['bulletin'] = self.bulletin.to_dict()
        # override the default output from pydantic by calling `to_dict()` of channel_item
        if self.channel_item:
            _dict['channelItem'] = self.channel_item.to_dict()
        # override the default output from pydantic by calling `to_dict()` of comment
        if self.comment:
            _dict['comment'] = self.comment.to_dict()
        # override the default output from pydantic by calling `to_dict()` of favorite
        if self.favorite:
            _dict['favorite'] = self.favorite.to_dict()
        # override the default output from pydantic by calling `to_dict()` of like
        if self.like:
            _dict['like'] = self.like.to_dict()
        # override the default output from pydantic by calling `to_dict()` of playlist_item
        if self.playlist_item:
            _dict['playlistItem'] = self.playlist_item.to_dict()
        # override the default output from pydantic by calling `to_dict()` of promoted_item
        if self.promoted_item:
            _dict['promotedItem'] = self.promoted_item.to_dict()
        # override the default output from pydantic by calling `to_dict()` of recommendation
        if self.recommendation:
            _dict['recommendation'] = self.recommendation.to_dict()
        # override the default output from pydantic by calling `to_dict()` of social
        if self.social:
            _dict['social'] = self.social.to_dict()
        # override the default output from pydantic by calling `to_dict()` of subscription
        if self.subscription:
            _dict['subscription'] = self.subscription.to_dict()
        # override the default output from pydantic by calling `to_dict()` of upload
        if self.upload:
            _dict['upload'] = self.upload.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "bulletin": ActivityContentDetailsBulletin.from_dict(obj["bulletin"]) if obj.get("bulletin") is not None else None,
            "channelItem": ActivityContentDetailsChannelItem.from_dict(obj["channelItem"]) if obj.get("channelItem") is not None else None,
            "comment": ActivityContentDetailsComment.from_dict(obj["comment"]) if obj.get("comment") is not None else None,
            "favorite": ActivityContentDetailsFavorite.from_dict(obj["favorite"]) if obj.get("favorite") is not None else None,
            "like": ActivityContentDetailsLike.from_dict(obj["like"]) if obj.get("like") is not None else None,
            "playlistItem": ActivityContentDetailsPlaylistItem.from_dict(obj["playlistItem"]) if obj.get("playlistItem") is not None else None,
            "promotedItem": ActivityContentDetailsPromotedItem.from_dict(obj["promotedItem"]) if obj.get("promotedItem") is not None else None,
            "recommendation": ActivityContentDetailsRecommendation.from_dict(obj["recommendation"]) if obj.get("recommendation") is not None else None,
            "social": ActivityContentDetailsSocial.from_dict(obj["social"]) if obj.get("social") is not None else None,
            "subscription": ActivityContentDetailsSubscription.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None,
            "upload": ActivityContentDetailsUpload.from_dict(obj["upload"]) if obj.get("upload") is not None else None
        })
        return _obj


