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

"""
shelldatareportingapis

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


class ExceptionProduct(object):

    """Implementation of the 'ExceptionProduct' model.

    TODO: type model description here.

    Attributes:
        productid (int): Product Id Optional if ProductCode is passed else
            Mandatory.
        product_code (str): Product Code Optional if ProductId is passed else
            Mandatory.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "productid": 'Productid',
        "product_code": 'ProductCode'
    }

    _optionals = [
        'productid',
        'product_code',
    ]

    _nullables = [
        'productid',
        'product_code',
    ]

    def __init__(self,
                 productid=APIHelper.SKIP,
                 product_code=APIHelper.SKIP):
        """Constructor for the ExceptionProduct class"""

        # Initialize members of the class
        if productid is not APIHelper.SKIP:
            self.productid = productid 
        if product_code is not APIHelper.SKIP:
            self.product_code = product_code 

    @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
        productid = dictionary.get("Productid") if "Productid" in dictionary.keys() else APIHelper.SKIP
        product_code = dictionary.get("ProductCode") if "ProductCode" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(productid,
                   product_code)
