"""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.level import Level
from mindbodypublicapi.models.program import (
    Program,
)
from mindbodypublicapi.models.session_type import (
    SessionType,
)


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

    Represents a class definition. The class meets at the start time, goes until the
    end time.

    Attributes:
        active (bool): When `true`, indicates that the business can assign this class
            description to new class schedules.<br />  When `false`, indicates that
            the business cannot assign this class description to new class schedules.
        description (str): The long version of the class description.
        id (int): The class description's ID.
        image_url (str): The class description's image URL, if any. If it does not
            exist, nothing is returned.
        last_updated (datetime): The date this class description was last modified.
        level (Level): A session level.
        name (str): The name of this class description.
        notes (str): Any notes about the class description.
        prereq (str): Any prerequisites for the class.
        program (Program): The model property of type Program.
        session_type (SessionType): SessionType contains information about the
            session types in a business.
        category (str): The category of this class description.
        category_id (int): The category ID of this class description.
        subcategory (str): The subcategory of this class description.
        subcategory_id (int): The subcategory ID of this class description.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "active": "Active",
        "description": "Description",
        "id": "Id",
        "image_url": "ImageURL",
        "last_updated": "LastUpdated",
        "level": "Level",
        "name": "Name",
        "notes": "Notes",
        "prereq": "Prereq",
        "program": "Program",
        "session_type": "SessionType",
        "category": "Category",
        "category_id": "CategoryId",
        "subcategory": "Subcategory",
        "subcategory_id": "SubcategoryId",
    }

    _optionals = [
        "active",
        "description",
        "id",
        "image_url",
        "last_updated",
        "level",
        "name",
        "notes",
        "prereq",
        "program",
        "session_type",
        "category",
        "category_id",
        "subcategory",
        "subcategory_id",
    ]

    def __init__(
        self,
        active=APIHelper.SKIP,
        description=APIHelper.SKIP,
        id=APIHelper.SKIP,
        image_url=APIHelper.SKIP,
        last_updated=APIHelper.SKIP,
        level=APIHelper.SKIP,
        name=APIHelper.SKIP,
        notes=APIHelper.SKIP,
        prereq=APIHelper.SKIP,
        program=APIHelper.SKIP,
        session_type=APIHelper.SKIP,
        category=APIHelper.SKIP,
        category_id=APIHelper.SKIP,
        subcategory=APIHelper.SKIP,
        subcategory_id=APIHelper.SKIP):
        """Initialize a ClassDescription instance."""
        # Initialize members of the class
        if active is not APIHelper.SKIP:
            self.active = active
        if description is not APIHelper.SKIP:
            self.description = description
        if id is not APIHelper.SKIP:
            self.id = id
        if image_url is not APIHelper.SKIP:
            self.image_url = image_url
        if last_updated is not APIHelper.SKIP:
            self.last_updated =\
                 APIHelper.apply_datetime_converter(
                last_updated, APIHelper.RFC3339DateTime)\
                 if last_updated else None
        if level is not APIHelper.SKIP:
            self.level = level
        if name is not APIHelper.SKIP:
            self.name = name
        if notes is not APIHelper.SKIP:
            self.notes = notes
        if prereq is not APIHelper.SKIP:
            self.prereq = prereq
        if program is not APIHelper.SKIP:
            self.program = program
        if session_type is not APIHelper.SKIP:
            self.session_type = session_type
        if category is not APIHelper.SKIP:
            self.category = category
        if category_id is not APIHelper.SKIP:
            self.category_id = category_id
        if subcategory is not APIHelper.SKIP:
            self.subcategory = subcategory
        if subcategory_id is not APIHelper.SKIP:
            self.subcategory_id = subcategory_id

    @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
        active =\
            dictionary.get("Active")\
            if "Active" in dictionary.keys()\
                else APIHelper.SKIP
        description =\
            dictionary.get("Description")\
            if dictionary.get("Description")\
                else APIHelper.SKIP
        id =\
            dictionary.get("Id")\
            if dictionary.get("Id")\
                else APIHelper.SKIP
        image_url =\
            dictionary.get("ImageURL")\
            if dictionary.get("ImageURL")\
                else APIHelper.SKIP
        last_updated = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("LastUpdated")).datetime\
            if dictionary.get("LastUpdated") else APIHelper.SKIP
        level =\
            Level.from_dictionary(
                dictionary.get("Level"))\
                if "Level" in dictionary.keys()\
                else APIHelper.SKIP
        name =\
            dictionary.get("Name")\
            if dictionary.get("Name")\
                else APIHelper.SKIP
        notes =\
            dictionary.get("Notes")\
            if dictionary.get("Notes")\
                else APIHelper.SKIP
        prereq =\
            dictionary.get("Prereq")\
            if dictionary.get("Prereq")\
                else APIHelper.SKIP
        program =\
            Program.from_dictionary(
                dictionary.get("Program"))\
                if "Program" in dictionary.keys()\
                else APIHelper.SKIP
        session_type =\
            SessionType.from_dictionary(
                dictionary.get("SessionType"))\
                if "SessionType" in dictionary.keys()\
                else APIHelper.SKIP
        category =\
            dictionary.get("Category")\
            if dictionary.get("Category")\
                else APIHelper.SKIP
        category_id =\
            dictionary.get("CategoryId")\
            if dictionary.get("CategoryId")\
                else APIHelper.SKIP
        subcategory =\
            dictionary.get("Subcategory")\
            if dictionary.get("Subcategory")\
                else APIHelper.SKIP
        subcategory_id =\
            dictionary.get("SubcategoryId")\
            if dictionary.get("SubcategoryId")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(active,
                   description,
                   id,
                   image_url,
                   last_updated,
                   level,
                   name,
                   notes,
                   prereq,
                   program,
                   session_type,
                   category,
                   category_id,
                   subcategory,
                   subcategory_id)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _active=(
            self.active
            if hasattr(self, "active")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _image_url=(
            self.image_url
            if hasattr(self, "image_url")
            else None
        )
        _last_updated=(
            self.last_updated
            if hasattr(self, "last_updated")
            else None
        )
        _level=(
            self.level
            if hasattr(self, "level")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _prereq=(
            self.prereq
            if hasattr(self, "prereq")
            else None
        )
        _program=(
            self.program
            if hasattr(self, "program")
            else None
        )
        _session_type=(
            self.session_type
            if hasattr(self, "session_type")
            else None
        )
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _subcategory=(
            self.subcategory
            if hasattr(self, "subcategory")
            else None
        )
        _subcategory_id=(
            self.subcategory_id
            if hasattr(self, "subcategory_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"active={_active!r}, "
            f"description={_description!r}, "
            f"id={_id!r}, "
            f"image_url={_image_url!r}, "
            f"last_updated={_last_updated!r}, "
            f"level={_level!r}, "
            f"name={_name!r}, "
            f"notes={_notes!r}, "
            f"prereq={_prereq!r}, "
            f"program={_program!r}, "
            f"session_type={_session_type!r}, "
            f"category={_category!r}, "
            f"category_id={_category_id!r}, "
            f"subcategory={_subcategory!r}, "
            f"subcategory_id={_subcategory_id!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _active=(
            self.active
            if hasattr(self, "active")
            else None
        )
        _description=(
            self.description
            if hasattr(self, "description")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _image_url=(
            self.image_url
            if hasattr(self, "image_url")
            else None
        )
        _last_updated=(
            self.last_updated
            if hasattr(self, "last_updated")
            else None
        )
        _level=(
            self.level
            if hasattr(self, "level")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _notes=(
            self.notes
            if hasattr(self, "notes")
            else None
        )
        _prereq=(
            self.prereq
            if hasattr(self, "prereq")
            else None
        )
        _program=(
            self.program
            if hasattr(self, "program")
            else None
        )
        _session_type=(
            self.session_type
            if hasattr(self, "session_type")
            else None
        )
        _category=(
            self.category
            if hasattr(self, "category")
            else None
        )
        _category_id=(
            self.category_id
            if hasattr(self, "category_id")
            else None
        )
        _subcategory=(
            self.subcategory
            if hasattr(self, "subcategory")
            else None
        )
        _subcategory_id=(
            self.subcategory_id
            if hasattr(self, "subcategory_id")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"active={_active!s}, "
            f"description={_description!s}, "
            f"id={_id!s}, "
            f"image_url={_image_url!s}, "
            f"last_updated={_last_updated!s}, "
            f"level={_level!s}, "
            f"name={_name!s}, "
            f"notes={_notes!s}, "
            f"prereq={_prereq!s}, "
            f"program={_program!s}, "
            f"session_type={_session_type!s}, "
            f"category={_category!s}, "
            f"category_id={_category_id!s}, "
            f"subcategory={_subcategory!s}, "
            f"subcategory_id={_subcategory_id!s}, "
            f")"
        )
