/* tslint:disable */
/* eslint-disable */
/**
 * Indexea OpenAPI
 * 这是 Indexea 搜索服务平台的 OpenAPI，用于描述平台的所有接口信息，你可以通过这个页面来了解和在线验证平台的所有接口信息。  ### Errors  本 API 使用标准的 HTTP 状态码来指示操作成功或者失败，如果失败将会在 body 中以 JSON 格式提供详细的错误信息，如下所示：  ``` {   \"error\": 404,   \"message\": \"page not found\" } ``` 
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: indexea.com@gmail.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 type { PaymentOrder } from './PaymentOrder';
import {
    PaymentOrderFromJSON,
    PaymentOrderFromJSONTyped,
    PaymentOrderToJSON,
} from './PaymentOrder';

/**
 * 发票信息
 * @export
 * @interface PaymentInvoice
 */
export interface PaymentInvoice {
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    id?: number;
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    account?: number;
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    app?: number;
    /**
     * 
     * @type {Array<PaymentOrder>}
     * @memberof PaymentInvoice
     */
    orders?: Array<PaymentOrder>;
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    price?: number;
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    type?: number;
    /**
     * 
     * @type {number}
     * @memberof PaymentInvoice
     */
    status?: number;
    /**
     * 
     * @type {Date}
     * @memberof PaymentInvoice
     */
    createdAt?: Date;
    /**
     * 
     * @type {Array<string>}
     * @memberof PaymentInvoice
     */
    logs?: Array<string>;
}

/**
 * Check if a given object implements the PaymentInvoice interface.
 */
export function instanceOfPaymentInvoice(value: object): boolean {
    let isInstance = true;

    return isInstance;
}

export function PaymentInvoiceFromJSON(json: any): PaymentInvoice {
    return PaymentInvoiceFromJSONTyped(json, false);
}

export function PaymentInvoiceFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaymentInvoice {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'id': !exists(json, 'id') ? undefined : json['id'],
        'account': !exists(json, 'account') ? undefined : json['account'],
        'app': !exists(json, 'app') ? undefined : json['app'],
        'orders': !exists(json, 'orders') ? undefined : ((json['orders'] as Array<any>).map(PaymentOrderFromJSON)),
        'price': !exists(json, 'price') ? undefined : json['price'],
        'type': !exists(json, 'type') ? undefined : json['type'],
        'status': !exists(json, 'status') ? undefined : json['status'],
        'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
        'logs': !exists(json, 'logs') ? undefined : json['logs'],
    };
}

export function PaymentInvoiceToJSON(value?: PaymentInvoice | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'id': value.id,
        'account': value.account,
        'app': value.app,
        'orders': value.orders === undefined ? undefined : ((value.orders as Array<any>).map(PaymentOrderToJSON)),
        'price': value.price,
        'type': value.type,
        'status': value.status,
        'created_at': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
        'logs': value.logs,
    };
}

