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

"""
ctddocumentation

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


class CTDLoginException(object):

    """Implementation of the 'CTDLoginException' model.

    TODO: type model description here.

    Attributes:
        error (string): TODO: type description here.
        exception (string): TODO: type description here.
        exception_class (string): TODO: type description here.
        success (bool): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "error": 'error',
        "exception": 'exception',
        "exception_class": 'exception_class',
        "success": 'success'
    }

    _optionals = [
        'error',
        'exception',
        'exception_class',
        'success',
    ]

    def __init__(self,
                 error=APIHelper.SKIP,
                 exception=APIHelper.SKIP,
                 exception_class=APIHelper.SKIP,
                 success=APIHelper.SKIP):
        """Constructor for the CTDLoginException class"""

        # Initialize members of the class
        if error is not APIHelper.SKIP:
            self.error = error 
        if exception is not APIHelper.SKIP:
            self.exception = exception 
        if exception_class is not APIHelper.SKIP:
            self.exception_class = exception_class 
        if success is not APIHelper.SKIP:
            self.success = success 

    @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 dictionary is None:
            return None

        # Extract variables from the dictionary

        error = dictionary.get("error") if dictionary.get("error") else APIHelper.SKIP
        exception = dictionary.get("exception") if dictionary.get("exception") else APIHelper.SKIP
        exception_class = dictionary.get("exception_class") if dictionary.get("exception_class") else APIHelper.SKIP
        success = dictionary.get("success") if "success" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(error,
                   exception,
                   exception_class,
                   success)
