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

"""
    pagarmecoreapi

    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""

import pagarmecoreapi.models.create_phone_request
import pagarmecoreapi.models.create_address_request

class CreateSubMerchantRequest(object):

    """Implementation of the 'CreateSubMerchantRequest' model.

    SubMerchant

    Attributes:
        payment_facilitator_code (string): Payment Facilitator Code
        code (string): Code
        name (string): Name
        merchant_category_code (string): Merchant Category Code
        document (string): Document number. Only numbers, no special
            characters.
        mtype (string): Document type. Can be either 'individual' or
            'company'
        phone (CreatePhoneRequest): Phone
        address (CreateAddressRequest): Address

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "payment_facilitator_code":'payment_facilitator_code',
        "code":'code',
        "name":'name',
        "merchant_category_code":'merchant_category_code',
        "document":'document',
        "mtype":'type',
        "phone":'phone',
        "address":'address'
    }

    def __init__(self,
                 payment_facilitator_code=None,
                 code=None,
                 name=None,
                 merchant_category_code=None,
                 document=None,
                 mtype=None,
                 phone=None,
                 address=None):
        """Constructor for the CreateSubMerchantRequest class"""

        # Initialize members of the class
        self.payment_facilitator_code = payment_facilitator_code
        self.code = code
        self.name = name
        self.merchant_category_code = merchant_category_code
        self.document = document
        self.mtype = mtype
        self.phone = phone
        self.address = address


    @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
        payment_facilitator_code = dictionary.get('payment_facilitator_code')
        code = dictionary.get('code')
        name = dictionary.get('name')
        merchant_category_code = dictionary.get('merchant_category_code')
        document = dictionary.get('document')
        mtype = dictionary.get('type')
        phone = pagarmecoreapi.models.create_phone_request.CreatePhoneRequest.from_dictionary(dictionary.get('phone')) if dictionary.get('phone') else None
        address = pagarmecoreapi.models.create_address_request.CreateAddressRequest.from_dictionary(dictionary.get('address')) if dictionary.get('address') else None

        # Return an object of this model
        return cls(payment_facilitator_code,
                   code,
                   name,
                   merchant_category_code,
                   document,
                   mtype,
                   phone,
                   address)


