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

"""
shelldatareportingapis

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


class UpdateOdometerRequest(object):

    """Implementation of the 'UpdateOdometerRequest' model.

    TODO: type model description here.

    Attributes:
        col_co_id (int): Collecting Company Id  of the selected payer.  
            Optional if ColCoCode is passed else Mandatory.  Example:  1 for
            Philippines  5 for UK
        col_co_code (int): Collecting Company Code (Shell Code) of the
            selected payer.   Mandatory for serviced OUs such as Romania,
            Latvia, Lithuania, Estonia, Ukraine etc. It is optional for other
            countries if ColCoID is provided.
        payer_id (int): Payer Id (i.e. Customer Id of the Payment Customer in
            Cards Platform) of the selected payer. Optional if PayerNumber is
            passed else Mandatory
        account_id (int): Account Id (i.e. Customer Id of the Sub Account in
            GFN) of the selected account. Optional if AccountNumber is passed
            else Mandatory
        account_number (str): Account Number (ex: GB000000123) of the selected
            account. Optional if AccountId is passed else Mandatory
        update_odometers (List[UpdateOdometer]): TODO: type description here.
        notify_caller (bool): True/False. Optional. Default: False If true,
            the caller would be notified back with the status as success or
            failure after the update odometer is processed.
        caller (str): The caller to be notified with the status of the update
            odometer. Mandatory, if NotifyCaller is true.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "col_co_id": 'ColCoId',
        "col_co_code": 'ColCoCode',
        "payer_id": 'PayerId',
        "account_id": 'AccountId',
        "account_number": 'AccountNumber',
        "update_odometers": 'UpdateOdometers',
        "notify_caller": 'NotifyCaller',
        "caller": 'Caller'
    }

    _optionals = [
        'col_co_id',
        'col_co_code',
        'payer_id',
        'account_id',
        'account_number',
        'update_odometers',
        'notify_caller',
        'caller',
    ]

    def __init__(self,
                 col_co_id=APIHelper.SKIP,
                 col_co_code=APIHelper.SKIP,
                 payer_id=APIHelper.SKIP,
                 account_id=APIHelper.SKIP,
                 account_number=APIHelper.SKIP,
                 update_odometers=APIHelper.SKIP,
                 notify_caller=APIHelper.SKIP,
                 caller=APIHelper.SKIP):
        """Constructor for the UpdateOdometerRequest class"""

        # Initialize members of the class
        if col_co_id is not APIHelper.SKIP:
            self.col_co_id = col_co_id 
        if col_co_code is not APIHelper.SKIP:
            self.col_co_code = col_co_code 
        if payer_id is not APIHelper.SKIP:
            self.payer_id = payer_id 
        if account_id is not APIHelper.SKIP:
            self.account_id = account_id 
        if account_number is not APIHelper.SKIP:
            self.account_number = account_number 
        if update_odometers is not APIHelper.SKIP:
            self.update_odometers = update_odometers 
        if notify_caller is not APIHelper.SKIP:
            self.notify_caller = notify_caller 
        if caller is not APIHelper.SKIP:
            self.caller = caller 

    @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
        col_co_id = dictionary.get("ColCoId") if dictionary.get("ColCoId") else APIHelper.SKIP
        col_co_code = dictionary.get("ColCoCode") if dictionary.get("ColCoCode") else APIHelper.SKIP
        payer_id = dictionary.get("PayerId") if dictionary.get("PayerId") else APIHelper.SKIP
        account_id = dictionary.get("AccountId") if dictionary.get("AccountId") else APIHelper.SKIP
        account_number = dictionary.get("AccountNumber") if dictionary.get("AccountNumber") else APIHelper.SKIP
        update_odometers = None
        if dictionary.get('UpdateOdometers') is not None:
            update_odometers = [UpdateOdometer.from_dictionary(x) for x in dictionary.get('UpdateOdometers')]
        else:
            update_odometers = APIHelper.SKIP
        notify_caller = dictionary.get("NotifyCaller") if "NotifyCaller" in dictionary.keys() else APIHelper.SKIP
        caller = dictionary.get("Caller") if dictionary.get("Caller") else APIHelper.SKIP
        # Return an object of this model
        return cls(col_co_id,
                   col_co_code,
                   payer_id,
                   account_id,
                   account_number,
                   update_odometers,
                   notify_caller,
                   caller)
