# coding: utf-8

"""
    CampaignManagementService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from openapi_client.models.campaign.day import Day
from openapi_client.models.campaign.minute import Minute
from typing_extensions import Self

class DayTime(BaseModel):
    """
    DayTime
    """ # noqa: E501
    day: Optional[Day] = Field(default=None, alias="Day")
    start_hour: Optional[StrictInt] = Field(default=None, alias="StartHour")
    start_minute: Optional[Minute] = Field(default=None, alias="StartMinute")
    end_hour: Optional[StrictInt] = Field(default=None, alias="EndHour")
    end_minute: Optional[Minute] = Field(default=None, alias="EndMinute")
    __properties: ClassVar[List[str]] = ["Day", "StartHour", "StartMinute", "EndHour", "EndMinute"]

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

    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,
        )
        # set to None if day (nullable) is None
        # and model_fields_set contains the field
        if self.day is None and "day" in self.model_fields_set:
            _dict['Day'] = None

        # set to None if start_hour (nullable) is None
        # and model_fields_set contains the field
        if self.start_hour is None and "start_hour" in self.model_fields_set:
            _dict['StartHour'] = None

        # set to None if start_minute (nullable) is None
        # and model_fields_set contains the field
        if self.start_minute is None and "start_minute" in self.model_fields_set:
            _dict['StartMinute'] = None

        # set to None if end_hour (nullable) is None
        # and model_fields_set contains the field
        if self.end_hour is None and "end_hour" in self.model_fields_set:
            _dict['EndHour'] = None

        # set to None if end_minute (nullable) is None
        # and model_fields_set contains the field
        if self.end_minute is None and "end_minute" in self.model_fields_set:
            _dict['EndMinute'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "Day": obj.get("Day") if obj.get("Day") is not None else None,
                        "StartHour": obj.get("StartHour") if obj.get("StartHour") is not None else None,
                        "StartMinute": obj.get("StartMinute") if obj.get("StartMinute") is not None else None,
                        "EndHour": obj.get("EndHour") if obj.get("EndHour") is not None else None,
                        "EndMinute": obj.get("EndMinute") if obj.get("EndMinute") is not None else None
        })
        return _obj
