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

'use strict';

const BaseModel = require('./BaseModel');

/**
 * Creates an instance of CreatePaymentRequest
 */
class CreatePaymentRequest extends BaseModel {
    /**
     * @constructor
     * @param   {Object}  obj    The object passed to constructor
     */
    constructor(obj) {
        super(obj);
        if (obj === undefined || obj === null) return;
        this.paymentMethod = this.constructor.getValue(obj.paymentMethod || obj.payment_method);
        this.creditCard = this.constructor.getValue(obj.creditCard || obj.credit_card);
        this.debitCard = this.constructor.getValue(obj.debitCard || obj.debit_card);
        this.boleto = this.constructor.getValue(obj.boleto);
        this.currency = this.constructor.getValue(obj.currency);
        this.voucher = this.constructor.getValue(obj.voucher);
        this.split = this.constructor.getValue(obj.split);
        this.bankTransfer = this.constructor.getValue(obj.bankTransfer || obj.bank_transfer);
        this.gatewayAffiliationId =
          this.constructor.getValue(obj.gatewayAffiliationId
     || obj.gateway_affiliation_id);
        this.amount = this.constructor.getValue(obj.amount);
        this.checkout = this.constructor.getValue(obj.checkout);
        this.customerId = this.constructor.getValue(obj.customerId || obj.customer_id);
        this.customer = this.constructor.getValue(obj.customer);
        this.metadata = this.constructor.getValue(obj.metadata);
        this.cash = this.constructor.getValue(obj.cash);
        this.privateLabel = this.constructor.getValue(obj.privateLabel || obj.private_label);
    }

    /**
     * Function containing information about the fields of this model
     * @return   {array}   Array of objects containing information about the fields
     */
    static mappingInfo() {
        return super.mappingInfo().concat([
            { name: 'paymentMethod', realName: 'payment_method' },
            { name: 'creditCard', realName: 'credit_card', type: 'CreateCreditCardPaymentRequest' },
            { name: 'debitCard', realName: 'debit_card', type: 'CreateDebitCardPaymentRequest' },
            { name: 'boleto', realName: 'boleto', type: 'CreateBoletoPaymentRequest' },
            { name: 'currency', realName: 'currency' },
            { name: 'voucher', realName: 'voucher', type: 'CreateVoucherPaymentRequest' },
            { name: 'split', realName: 'split', array: true, type: 'CreateSplitRequest' },
            {
                name: 'bankTransfer',
                realName: 'bank_transfer',
                type: 'CreateBankTransferPaymentRequest',
            },
            { name: 'gatewayAffiliationId', realName: 'gateway_affiliation_id' },
            { name: 'amount', realName: 'amount' },
            { name: 'checkout', realName: 'checkout', type: 'CreateCheckoutPaymentRequest' },
            { name: 'customerId', realName: 'customer_id' },
            { name: 'customer', realName: 'customer', type: 'CreateCustomerRequest' },
            { name: 'metadata', realName: 'metadata' },
            { name: 'cash', realName: 'cash', type: 'CreateCashPaymentRequest' },
            {
                name: 'privateLabel',
                realName: 'private_label',
                type: 'CreatePrivateLabelPaymentRequest',
            },
        ]);
    }

    /**
     * Function containing information about discriminator values
     * mapped with their corresponding model class names
     *
     * @return   {object}  Object containing Key-Value pairs mapping discriminator
     *                     values with their corresponding model classes
     */
    static discriminatorMap() {
        return {};
    }
}

module.exports = CreatePaymentRequest;
