/* tslint:disable */
/* eslint-disable */
/**
 * Apideck
 * The Apideck OpenAPI Spec: SDK Optimized
 *
 * The version of the OpenAPI document: 10.13.0
 * Contact: support@apideck.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 } from '../runtime'
import {
  OutstandingBalanceByCurrency,
  OutstandingBalanceByCurrencyFromJSON,
  OutstandingBalanceByCurrencyToJSON
} from './OutstandingBalanceByCurrency'

/**
 *
 * @export
 * @interface OutstandingBalanceBySupplier
 */
export interface OutstandingBalanceBySupplier {
  /**
   * Unique identifier for the supplier.
   * @type {string}
   * @memberof OutstandingBalanceBySupplier
   */
  supplier_id?: string
  /**
   * Full name of the supplier.
   * @type {string}
   * @memberof OutstandingBalanceBySupplier
   */
  supplier_name?: string
  /**
   *
   * @type {Array<OutstandingBalanceByCurrency>}
   * @memberof OutstandingBalanceBySupplier
   */
  outstanding_balances_by_currency?: Array<OutstandingBalanceByCurrency>
}

export function OutstandingBalanceBySupplierFromJSON(json: any): OutstandingBalanceBySupplier {
  return OutstandingBalanceBySupplierFromJSONTyped(json, false)
}

export function OutstandingBalanceBySupplierFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean
): OutstandingBalanceBySupplier {
  if (json === undefined || json === null) {
    return json
  }
  return {
    supplier_id: !exists(json, 'supplier_id') ? undefined : json['supplier_id'],
    supplier_name: !exists(json, 'supplier_name') ? undefined : json['supplier_name'],
    outstanding_balances_by_currency: !exists(json, 'outstanding_balances_by_currency')
      ? undefined
      : (json['outstanding_balances_by_currency'] as Array<any>).map(
          OutstandingBalanceByCurrencyFromJSON
        )
  }
}

export function OutstandingBalanceBySupplierToJSON(
  value?: OutstandingBalanceBySupplier | null
): any {
  if (value === undefined) {
    return undefined
  }
  if (value === null) {
    return null
  }
  return {
    supplier_id: value.supplier_id,
    supplier_name: value.supplier_name,
    outstanding_balances_by_currency:
      value.outstanding_balances_by_currency === undefined
        ? undefined
        : (value.outstanding_balances_by_currency as Array<any>).map(
            OutstandingBalanceByCurrencyToJSON
          )
  }
}
