# 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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class VideoStatus(BaseModel):
    """
    Basic details about a video category, such as its localized title. Next Id: 19
    """ # noqa: E501
    contains_synthetic_media: Optional[StrictBool] = Field(default=None, description="Indicates if the video contains altered or synthetic media.", alias="containsSyntheticMedia")
    embeddable: Optional[StrictBool] = Field(default=None, description="This value indicates if the video can be embedded on another website. @mutable youtube.videos.insert youtube.videos.update")
    failure_reason: Optional[StrictStr] = Field(default=None, description="This value explains why a video failed to upload. This property is only present if the uploadStatus property indicates that the upload failed.", alias="failureReason")
    license: Optional[StrictStr] = Field(default=None, description="The video's license. @mutable youtube.videos.insert youtube.videos.update")
    made_for_kids: Optional[StrictBool] = Field(default=None, alias="madeForKids")
    privacy_status: Optional[StrictStr] = Field(default=None, description="The video's privacy status.", alias="privacyStatus")
    public_stats_viewable: Optional[StrictBool] = Field(default=None, description="This value indicates if the extended video statistics on the watch page can be viewed by everyone. Note that the view count, likes, etc will still be visible if this is disabled. @mutable youtube.videos.insert youtube.videos.update", alias="publicStatsViewable")
    publish_at: Optional[datetime] = Field(default=None, description="The date and time when the video is scheduled to publish. It can be set only if the privacy status of the video is private..", alias="publishAt")
    rejection_reason: Optional[StrictStr] = Field(default=None, description="This value explains why YouTube rejected an uploaded video. This property is only present if the uploadStatus property indicates that the upload was rejected.", alias="rejectionReason")
    self_declared_made_for_kids: Optional[StrictBool] = Field(default=None, alias="selfDeclaredMadeForKids")
    upload_status: Optional[StrictStr] = Field(default=None, description="The status of the uploaded video.", alias="uploadStatus")
    __properties: ClassVar[List[str]] = ["containsSyntheticMedia", "embeddable", "failureReason", "license", "madeForKids", "privacyStatus", "publicStatsViewable", "publishAt", "rejectionReason", "selfDeclaredMadeForKids", "uploadStatus"]

    @field_validator('failure_reason')
    def failure_reason_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['conversion', 'invalidFile', 'emptyFile', 'tooSmall', 'codec', 'uploadAborted']):
            raise ValueError("must be one of enum values ('conversion', 'invalidFile', 'emptyFile', 'tooSmall', 'codec', 'uploadAborted')")
        return value

    @field_validator('license')
    def license_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['youtube', 'creativeCommon']):
            raise ValueError("must be one of enum values ('youtube', 'creativeCommon')")
        return value

    @field_validator('privacy_status')
    def privacy_status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['public', 'unlisted', 'private']):
            raise ValueError("must be one of enum values ('public', 'unlisted', 'private')")
        return value

    @field_validator('rejection_reason')
    def rejection_reason_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['copyright', 'inappropriate', 'duplicate', 'termsOfUse', 'uploaderAccountSuspended', 'length', 'claim', 'uploaderAccountClosed', 'trademark', 'legal']):
            raise ValueError("must be one of enum values ('copyright', 'inappropriate', 'duplicate', 'termsOfUse', 'uploaderAccountSuspended', 'length', 'claim', 'uploaderAccountClosed', 'trademark', 'legal')")
        return value

    @field_validator('upload_status')
    def upload_status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['uploaded', 'processed', 'failed', 'rejected', 'deleted']):
            raise ValueError("must be one of enum values ('uploaded', 'processed', 'failed', 'rejected', 'deleted')")
        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 VideoStatus 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "containsSyntheticMedia": obj.get("containsSyntheticMedia"),
            "embeddable": obj.get("embeddable"),
            "failureReason": obj.get("failureReason"),
            "license": obj.get("license"),
            "madeForKids": obj.get("madeForKids"),
            "privacyStatus": obj.get("privacyStatus"),
            "publicStatsViewable": obj.get("publicStatsViewable"),
            "publishAt": obj.get("publishAt"),
            "rejectionReason": obj.get("rejectionReason"),
            "selfDeclaredMadeForKids": obj.get("selfDeclaredMadeForKids"),
            "uploadStatus": obj.get("uploadStatus")
        })
        return _obj


