/* tslint:disable */
/* eslint-disable */
/**
 * Paystack
 * The OpenAPI specification of the Paystack API that merchants and developers can harness to build financial solutions in Africa.
 *
 * The version of the Paystack Node library: 1.0.0
 * Contact: techsupport@paystack.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists, mapValues } from '../runtime';
import {
    SplitSubaccounts,
    SplitSubaccountsFromJSON,
    SplitSubaccountsFromJSONTyped,
    SplitSubaccountsToJSON,
} from './';

/**
 * 
 * @export
 * @interface SplitCreate
 */
export interface SplitCreate {
    /**
     * Name of the transaction split
     * @type {string}
     * @memberof SplitCreate
     */
    name: string;
    /**
     * The type of transaction split you want to create.
     * @type {string}
     * @memberof SplitCreate
     */
    type: string;
    /**
     * A list of object containing subaccount code and number of shares
     * @type {Array<SplitSubaccounts>}
     * @memberof SplitCreate
     */
    subaccounts: Array<SplitSubaccounts>;
    /**
     * The transaction currency
     * @type {string}
     * @memberof SplitCreate
     */
    currency: string;
    /**
     * This allows you specify how the transaction charge should be processed
     * @type {string}
     * @memberof SplitCreate
     */
    bearerType?: string;
    /**
     * This is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type
     * @type {string}
     * @memberof SplitCreate
     */
    bearerSubaccount?: string;
}

export function SplitCreateFromJSON(json: any): SplitCreate {
    return SplitCreateFromJSONTyped(json, false);
}

export function SplitCreateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SplitCreate {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'name': json['name'],
        'type': json['type'],
        'subaccounts': ((json['subaccounts'] as Array<any>).map(SplitSubaccountsFromJSON)),
        'currency': json['currency'],
        'bearerType': !exists(json, 'bearer_type') ? undefined : json['bearer_type'],
        'bearerSubaccount': !exists(json, 'bearer_subaccount') ? undefined : json['bearer_subaccount'],
    };
}

export function SplitCreateToJSON(value?: SplitCreate | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'name': value.name,
        'type': value.type,
        'subaccounts': ((value.subaccounts as Array<any>).map(SplitSubaccountsToJSON)),
        'currency': value.currency,
        'bearer_type': value.bearerType,
        'bearer_subaccount': value.bearerSubaccount,
    };
}


