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

"""
spotifywebapiwithfixesandimprovementsfromsonallux

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


class AudioFeaturesObject(object):

    """Implementation of the 'AudioFeaturesObject' model.

    Attributes:
        acousticness (float): A confidence measure from 0.0 to 1.0 of whether
            the track is acoustic. 1.0 represents high confidence the track is
            acoustic.
        analysis_url (str): A URL to access the full audio analysis of this
            track. An access token is required to access this data.
        danceability (float): Danceability describes how suitable a track is
            for dancing based on a combination of musical elements including
            tempo, rhythm stability, beat strength, and overall regularity. A
            value of 0.0 is least danceable and 1.0 is most danceable.
        duration_ms (int): The duration of the track in milliseconds.
        energy (float): Energy is a measure from 0.0 to 1.0 and represents a
            perceptual measure of intensity and activity. Typically, energetic
            tracks feel fast, loud, and noisy. For example, death metal has
            high energy, while a Bach prelude scores low on the scale.
            Perceptual features contributing to this attribute include dynamic
            range, perceived loudness, timbre, onset rate, and general entropy.
        id (str): The Spotify ID for the track.
        instrumentalness (float): Predicts whether a track contains no vocals.
            "Ooh" and "aah" sounds are treated as instrumental in this
            context. Rap or spoken word tracks are clearly "vocal". The closer
            the instrumentalness value is to 1.0, the greater likelihood the
            track contains no vocal content. Values above 0.5 are intended to
            represent instrumental tracks, but confidence is higher as the
            value approaches 1.0.
        key (int): The key the track is in. Integers map to pitches using
            standard [Pitch Class
            notation](https://en.wikipedia.org/wiki/Pitch_class). E.g. 0 = C,
            1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is
            -1.
        liveness (float): Detects the presence of an audience in the
            recording. Higher liveness values represent an increased
            probability that the track was performed live. A value above 0.8
            provides strong likelihood that the track is live.
        loudness (float): The overall loudness of a track in decibels (dB).
            Loudness values are averaged across the entire track and are
            useful for comparing relative loudness of tracks. Loudness is the
            quality of a sound that is the primary psychological correlate of
            physical strength (amplitude). Values typically range between -60
            and 0 db.
        mode (int): Mode indicates the modality (major or minor) of a track,
            the type of scale from which its melodic content is derived. Major
            is represented by 1 and minor is 0.
        speechiness (float): Speechiness detects the presence of spoken words
            in a track. The more exclusively speech-like the recording (e.g.
            talk show, audio book, poetry), the closer to 1.0 the attribute
            value. Values above 0.66 describe tracks that are probably made
            entirely of spoken words. Values between 0.33 and 0.66 describe
            tracks that may contain both music and speech, either in sections
            or layered, including such cases as rap music. Values below 0.33
            most likely represent music and other non-speech-like tracks.
        tempo (float): The overall estimated tempo of a track in beats per
            minute (BPM). In musical terminology, tempo is the speed or pace
            of a given piece and derives directly from the average beat
            duration.
        time_signature (int): An estimated time signature. The time signature
            (meter) is a notational convention to specify how many beats are
            in each bar (or measure). The time signature ranges from 3 to 7
            indicating time signatures of "3/4", to "7/4".
        track_href (str): A link to the Web API endpoint providing full
            details of the track.
        mtype (Type5Enum): The object type.
        uri (str): The Spotify URI for the track.
        valence (float): A measure from 0.0 to 1.0 describing the musical
            positiveness conveyed by a track. Tracks with high valence sound
            more positive (e.g. happy, cheerful, euphoric), while tracks with
            low valence sound more negative (e.g. sad, depressed, angry).

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "acousticness": 'acousticness',
        "analysis_url": 'analysis_url',
        "danceability": 'danceability',
        "duration_ms": 'duration_ms',
        "energy": 'energy',
        "id": 'id',
        "instrumentalness": 'instrumentalness',
        "key": 'key',
        "liveness": 'liveness',
        "loudness": 'loudness',
        "mode": 'mode',
        "speechiness": 'speechiness',
        "tempo": 'tempo',
        "time_signature": 'time_signature',
        "track_href": 'track_href',
        "mtype": 'type',
        "uri": 'uri',
        "valence": 'valence'
    }

    _optionals = [
        'acousticness',
        'analysis_url',
        'danceability',
        'duration_ms',
        'energy',
        'id',
        'instrumentalness',
        'key',
        'liveness',
        'loudness',
        'mode',
        'speechiness',
        'tempo',
        'time_signature',
        'track_href',
        'mtype',
        'uri',
        'valence',
    ]

    def __init__(self,
                 acousticness=APIHelper.SKIP,
                 analysis_url=APIHelper.SKIP,
                 danceability=APIHelper.SKIP,
                 duration_ms=APIHelper.SKIP,
                 energy=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 instrumentalness=APIHelper.SKIP,
                 key=APIHelper.SKIP,
                 liveness=APIHelper.SKIP,
                 loudness=APIHelper.SKIP,
                 mode=APIHelper.SKIP,
                 speechiness=APIHelper.SKIP,
                 tempo=APIHelper.SKIP,
                 time_signature=APIHelper.SKIP,
                 track_href=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 uri=APIHelper.SKIP,
                 valence=APIHelper.SKIP):
        """Constructor for the AudioFeaturesObject class"""

        # Initialize members of the class
        if acousticness is not APIHelper.SKIP:
            self.acousticness = acousticness 
        if analysis_url is not APIHelper.SKIP:
            self.analysis_url = analysis_url 
        if danceability is not APIHelper.SKIP:
            self.danceability = danceability 
        if duration_ms is not APIHelper.SKIP:
            self.duration_ms = duration_ms 
        if energy is not APIHelper.SKIP:
            self.energy = energy 
        if id is not APIHelper.SKIP:
            self.id = id 
        if instrumentalness is not APIHelper.SKIP:
            self.instrumentalness = instrumentalness 
        if key is not APIHelper.SKIP:
            self.key = key 
        if liveness is not APIHelper.SKIP:
            self.liveness = liveness 
        if loudness is not APIHelper.SKIP:
            self.loudness = loudness 
        if mode is not APIHelper.SKIP:
            self.mode = mode 
        if speechiness is not APIHelper.SKIP:
            self.speechiness = speechiness 
        if tempo is not APIHelper.SKIP:
            self.tempo = tempo 
        if time_signature is not APIHelper.SKIP:
            self.time_signature = time_signature 
        if track_href is not APIHelper.SKIP:
            self.track_href = track_href 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if uri is not APIHelper.SKIP:
            self.uri = uri 
        if valence is not APIHelper.SKIP:
            self.valence = valence 

    @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
        acousticness = dictionary.get("acousticness") if dictionary.get("acousticness") else APIHelper.SKIP
        analysis_url = dictionary.get("analysis_url") if dictionary.get("analysis_url") else APIHelper.SKIP
        danceability = dictionary.get("danceability") if dictionary.get("danceability") else APIHelper.SKIP
        duration_ms = dictionary.get("duration_ms") if dictionary.get("duration_ms") else APIHelper.SKIP
        energy = dictionary.get("energy") if dictionary.get("energy") else APIHelper.SKIP
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        instrumentalness = dictionary.get("instrumentalness") if dictionary.get("instrumentalness") else APIHelper.SKIP
        key = dictionary.get("key") if dictionary.get("key") else APIHelper.SKIP
        liveness = dictionary.get("liveness") if dictionary.get("liveness") else APIHelper.SKIP
        loudness = dictionary.get("loudness") if dictionary.get("loudness") else APIHelper.SKIP
        mode = dictionary.get("mode") if dictionary.get("mode") else APIHelper.SKIP
        speechiness = dictionary.get("speechiness") if dictionary.get("speechiness") else APIHelper.SKIP
        tempo = dictionary.get("tempo") if dictionary.get("tempo") else APIHelper.SKIP
        time_signature = dictionary.get("time_signature") if dictionary.get("time_signature") else APIHelper.SKIP
        track_href = dictionary.get("track_href") if dictionary.get("track_href") else APIHelper.SKIP
        mtype = dictionary.get("type") if dictionary.get("type") else APIHelper.SKIP
        uri = dictionary.get("uri") if dictionary.get("uri") else APIHelper.SKIP
        valence = dictionary.get("valence") if dictionary.get("valence") else APIHelper.SKIP
        # Return an object of this model
        return cls(acousticness,
                   analysis_url,
                   danceability,
                   duration_ms,
                   energy,
                   id,
                   instrumentalness,
                   key,
                   liveness,
                   loudness,
                   mode,
                   speechiness,
                   tempo,
                   time_signature,
                   track_href,
                   mtype,
                   uri,
                   valence)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'acousticness={(self.acousticness if hasattr(self, "acousticness") else None)!r}, '
                f'analysis_url={(self.analysis_url if hasattr(self, "analysis_url") else None)!r}, '
                f'danceability={(self.danceability if hasattr(self, "danceability") else None)!r}, '
                f'duration_ms={(self.duration_ms if hasattr(self, "duration_ms") else None)!r}, '
                f'energy={(self.energy if hasattr(self, "energy") else None)!r}, '
                f'id={(self.id if hasattr(self, "id") else None)!r}, '
                f'instrumentalness={(self.instrumentalness if hasattr(self, "instrumentalness") else None)!r}, '
                f'key={(self.key if hasattr(self, "key") else None)!r}, '
                f'liveness={(self.liveness if hasattr(self, "liveness") else None)!r}, '
                f'loudness={(self.loudness if hasattr(self, "loudness") else None)!r}, '
                f'mode={(self.mode if hasattr(self, "mode") else None)!r}, '
                f'speechiness={(self.speechiness if hasattr(self, "speechiness") else None)!r}, '
                f'tempo={(self.tempo if hasattr(self, "tempo") else None)!r}, '
                f'time_signature={(self.time_signature if hasattr(self, "time_signature") else None)!r}, '
                f'track_href={(self.track_href if hasattr(self, "track_href") else None)!r}, '
                f'mtype={(self.mtype if hasattr(self, "mtype") else None)!r}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!r}, '
                f'valence={(self.valence if hasattr(self, "valence") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'acousticness={(self.acousticness if hasattr(self, "acousticness") else None)!s}, '
                f'analysis_url={(self.analysis_url if hasattr(self, "analysis_url") else None)!s}, '
                f'danceability={(self.danceability if hasattr(self, "danceability") else None)!s}, '
                f'duration_ms={(self.duration_ms if hasattr(self, "duration_ms") else None)!s}, '
                f'energy={(self.energy if hasattr(self, "energy") else None)!s}, '
                f'id={(self.id if hasattr(self, "id") else None)!s}, '
                f'instrumentalness={(self.instrumentalness if hasattr(self, "instrumentalness") else None)!s}, '
                f'key={(self.key if hasattr(self, "key") else None)!s}, '
                f'liveness={(self.liveness if hasattr(self, "liveness") else None)!s}, '
                f'loudness={(self.loudness if hasattr(self, "loudness") else None)!s}, '
                f'mode={(self.mode if hasattr(self, "mode") else None)!s}, '
                f'speechiness={(self.speechiness if hasattr(self, "speechiness") else None)!s}, '
                f'tempo={(self.tempo if hasattr(self, "tempo") else None)!s}, '
                f'time_signature={(self.time_signature if hasattr(self, "time_signature") else None)!s}, '
                f'track_href={(self.track_href if hasattr(self, "track_href") else None)!s}, '
                f'mtype={(self.mtype if hasattr(self, "mtype") else None)!s}, '
                f'uri={(self.uri if hasattr(self, "uri") else None)!s}, '
                f'valence={(self.valence if hasattr(self, "valence") else None)!s})')
