# -*- coding: utf-8 -*-

"""
spotifywebapiwithfixesandimprovementsfromsonallux

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from spotifywebapiwithfixesandimprovementsfromsonallux.api_helper import APIHelper


class ResumePointObject(object):

    """Implementation of the 'ResumePointObject' model.

    Attributes:
        fully_played (bool): Whether or not the episode has been fully played
            by the user.
        resume_position_ms (int): The user's most recent position in the
            episode in milliseconds.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "fully_played": 'fully_played',
        "resume_position_ms": 'resume_position_ms'
    }

    _optionals = [
        'fully_played',
        'resume_position_ms',
    ]

    def __init__(self,
                 fully_played=APIHelper.SKIP,
                 resume_position_ms=APIHelper.SKIP):
        """Constructor for the ResumePointObject class"""

        # Initialize members of the class
        if fully_played is not APIHelper.SKIP:
            self.fully_played = fully_played 
        if resume_position_ms is not APIHelper.SKIP:
            self.resume_position_ms = resume_position_ms 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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
        fully_played = dictionary.get("fully_played") if "fully_played" in dictionary.keys() else APIHelper.SKIP
        resume_position_ms = dictionary.get("resume_position_ms") if dictionary.get("resume_position_ms") else APIHelper.SKIP
        # Return an object of this model
        return cls(fully_played,
                   resume_position_ms)

    @classmethod
    def validate(cls, dictionary):
        """Validates dictionary against class required properties

        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:
            boolean : if dictionary is valid contains required properties.

        """

        if isinstance(dictionary, cls):
            return True

        if not isinstance(dictionary, dict):
            return False

        return True

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'fully_played={(self.fully_played if hasattr(self, "fully_played") else None)!r}, '
                f'resume_position_ms={(self.resume_position_ms if hasattr(self, "resume_position_ms") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'fully_played={(self.fully_played if hasattr(self, "fully_played") else None)!s}, '
                f'resume_position_ms={(self.resume_position_ms if hasattr(self, "resume_position_ms") else None)!s})')
