"""mindbodypublicapi.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from mindbodypublicapi.api_helper import APIHelper
from mindbodypublicapi.models.pricing_relationships import (
    PricingRelationships,
)


class Program(object):
    """Implementation of the 'Program' model.

    Attributes:
        id (int): The service category’s ID.
        name (str): The name of this service category.
        schedule_type (ScheduleTypeEnum): The service category’s schedule type.
            Possible values are:  * All  * Class  * Enrollment  * Appointment  *
            Resource  * Arrival
        cancel_offset (int): The offset to use for the service category.
        content_formats (List[str]): The content delivery platform(s) used by the
            service category. Possible values are:  * InPerson  * Livestream:Mindbody
            * Livestream:Other
        pricing_relationships (PricingRelationships): The model property of type
            PricingRelationships.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "id": "Id",
        "name": "Name",
        "schedule_type": "ScheduleType",
        "cancel_offset": "CancelOffset",
        "content_formats": "ContentFormats",
        "pricing_relationships": "PricingRelationships",
    }

    _optionals = [
        "id",
        "name",
        "schedule_type",
        "cancel_offset",
        "content_formats",
        "pricing_relationships",
    ]

    def __init__(
        self,
        id=APIHelper.SKIP,
        name=APIHelper.SKIP,
        schedule_type=APIHelper.SKIP,
        cancel_offset=APIHelper.SKIP,
        content_formats=APIHelper.SKIP,
        pricing_relationships=APIHelper.SKIP):
        """Initialize a Program instance."""
        # Initialize members of the class
        if id is not APIHelper.SKIP:
            self.id = id
        if name is not APIHelper.SKIP:
            self.name = name
        if schedule_type is not APIHelper.SKIP:
            self.schedule_type = schedule_type
        if cancel_offset is not APIHelper.SKIP:
            self.cancel_offset = cancel_offset
        if content_formats is not APIHelper.SKIP:
            self.content_formats = content_formats
        if pricing_relationships is not APIHelper.SKIP:
            self.pricing_relationships = pricing_relationships

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        schedule_type =\
            dictionary.get("ScheduleType")\
            if dictionary.get("ScheduleType")\
                else APIHelper.SKIP
        cancel_offset =\
            dictionary.get("CancelOffset")\
            if dictionary.get("CancelOffset")\
                else APIHelper.SKIP
        content_formats =\
            dictionary.get("ContentFormats")\
            if dictionary.get("ContentFormats")\
                else APIHelper.SKIP
        pricing_relationships =\
            PricingRelationships.from_dictionary(
                dictionary.get("PricingRelationships"))\
                if "PricingRelationships" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(id,
                   name,
                   schedule_type,
                   cancel_offset,
                   content_formats,
                   pricing_relationships)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _schedule_type=(
            self.schedule_type
            if hasattr(self, "schedule_type")
            else None
        )
        _cancel_offset=(
            self.cancel_offset
            if hasattr(self, "cancel_offset")
            else None
        )
        _content_formats=(
            self.content_formats
            if hasattr(self, "content_formats")
            else None
        )
        _pricing_relationships=(
            self.pricing_relationships
            if hasattr(self, "pricing_relationships")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!r}, "
            f"name={_name!r}, "
            f"schedule_type={_schedule_type!r}, "
            f"cancel_offset={_cancel_offset!r}, "
            f"content_formats={_content_formats!r}, "
            f"pricing_relationships={_pricing_relationships!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _schedule_type=(
            self.schedule_type
            if hasattr(self, "schedule_type")
            else None
        )
        _cancel_offset=(
            self.cancel_offset
            if hasattr(self, "cancel_offset")
            else None
        )
        _content_formats=(
            self.content_formats
            if hasattr(self, "content_formats")
            else None
        )
        _pricing_relationships=(
            self.pricing_relationships
            if hasattr(self, "pricing_relationships")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"id={_id!s}, "
            f"name={_name!s}, "
            f"schedule_type={_schedule_type!s}, "
            f"cancel_offset={_cancel_offset!s}, "
            f"content_formats={_content_formats!s}, "
            f"pricing_relationships={_pricing_relationships!s}, "
            f")"
        )
