/* tslint:disable */
/* eslint-disable */
/**
 * UCX Proxy
 * A single use API for the UCX Proxy.
 *
 * The version of the OpenAPI document: 0.0.12
 * Contact: customersuccess@equisoft.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 { mapValues } from '../runtime';
import type { ContactReferenceSchema } from './ContactReferenceSchema';
import {
    ContactReferenceSchemaFromJSON,
    ContactReferenceSchemaFromJSONTyped,
    ContactReferenceSchemaToJSON,
    ContactReferenceSchemaToJSONTyped,
} from './ContactReferenceSchema';
import type { HoldingSchema } from './HoldingSchema';
import {
    HoldingSchemaFromJSON,
    HoldingSchemaFromJSONTyped,
    HoldingSchemaToJSON,
    HoldingSchemaToJSONTyped,
} from './HoldingSchema';
import type { InvestmentStatus } from './InvestmentStatus';
import {
    InvestmentStatusFromJSON,
    InvestmentStatusFromJSONTyped,
    InvestmentStatusToJSON,
    InvestmentStatusToJSONTyped,
} from './InvestmentStatus';
import type { RegistrationType } from './RegistrationType';
import {
    RegistrationTypeFromJSON,
    RegistrationTypeFromJSONTyped,
    RegistrationTypeToJSON,
    RegistrationTypeToJSONTyped,
} from './RegistrationType';
import type { AccountType } from './AccountType';
import {
    AccountTypeFromJSON,
    AccountTypeFromJSONTyped,
    AccountTypeToJSON,
    AccountTypeToJSONTyped,
} from './AccountType';

/**
 * 
 * @export
 * @interface InvestmentAccountSchema
 */
export interface InvestmentAccountSchema {
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    uniqueIdentifier: string;
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    externalIdentifier: string;
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    accountNumber: string;
    /**
     * 
     * @type {InvestmentStatus}
     * @memberof InvestmentAccountSchema
     */
    status?: InvestmentStatus | null;
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    description?: string | null;
    /**
     * 
     * @type {AccountType}
     * @memberof InvestmentAccountSchema
     */
    accountType?: AccountType | null;
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    jurisdiction?: string | null;
    /**
     * 
     * @type {RegistrationType}
     * @memberof InvestmentAccountSchema
     */
    registrationType?: RegistrationType | null;
    /**
     * 
     * @type {string}
     * @memberof InvestmentAccountSchema
     */
    currency?: string | null;
    /**
     * 
     * @type {number}
     * @memberof InvestmentAccountSchema
     */
    marketValue?: number | null;
    /**
     * 
     * @type {Date}
     * @memberof InvestmentAccountSchema
     */
    fetchedAt?: Date | null;
    /**
     * 
     * @type {Date}
     * @memberof InvestmentAccountSchema
     */
    asOfDate?: Date | null;
    /**
     * 
     * @type {Array<ContactReferenceSchema>}
     * @memberof InvestmentAccountSchema
     */
    owners?: Array<ContactReferenceSchema> | null;
    /**
     * 
     * @type {Array<ContactReferenceSchema>}
     * @memberof InvestmentAccountSchema
     */
    contributors?: Array<ContactReferenceSchema> | null;
    /**
     * 
     * @type {{ [key: string]: object; }}
     * @memberof InvestmentAccountSchema
     */
    sourceMetadata: { [key: string]: object; };
    /**
     * 
     * @type {Array<HoldingSchema>}
     * @memberof InvestmentAccountSchema
     */
    holdings?: Array<HoldingSchema> | null;
}



/**
 * Check if a given object implements the InvestmentAccountSchema interface.
 */
export function instanceOfInvestmentAccountSchema(value: object): value is InvestmentAccountSchema {
    if (!('uniqueIdentifier' in value) || value['uniqueIdentifier'] === undefined) return false;
    if (!('externalIdentifier' in value) || value['externalIdentifier'] === undefined) return false;
    if (!('accountNumber' in value) || value['accountNumber'] === undefined) return false;
    if (!('sourceMetadata' in value) || value['sourceMetadata'] === undefined) return false;
    return true;
}

export function InvestmentAccountSchemaFromJSON(json: any): InvestmentAccountSchema {
    return InvestmentAccountSchemaFromJSONTyped(json, false);
}

export function InvestmentAccountSchemaFromJSONTyped(json: any, ignoreDiscriminator: boolean): InvestmentAccountSchema {
    if (json == null) {
        return json;
    }
    return {
        
        'uniqueIdentifier': json['uniqueIdentifier'],
        'externalIdentifier': json['externalIdentifier'],
        'accountNumber': json['accountNumber'],
        'status': json['status'] == null ? undefined : InvestmentStatusFromJSON(json['status']),
        'description': json['description'] == null ? undefined : json['description'],
        'accountType': json['accountType'] == null ? undefined : AccountTypeFromJSON(json['accountType']),
        'jurisdiction': json['jurisdiction'] == null ? undefined : json['jurisdiction'],
        'registrationType': json['registrationType'] == null ? undefined : RegistrationTypeFromJSON(json['registrationType']),
        'currency': json['currency'] == null ? undefined : json['currency'],
        'marketValue': json['marketValue'] == null ? undefined : json['marketValue'],
        'fetchedAt': json['fetchedAt'] == null ? undefined : (new Date(json['fetchedAt'])),
        'asOfDate': json['asOfDate'] == null ? undefined : (new Date(json['asOfDate'])),
        'owners': json['owners'] == null ? undefined : ((json['owners'] as Array<any>).map(ContactReferenceSchemaFromJSON)),
        'contributors': json['contributors'] == null ? undefined : ((json['contributors'] as Array<any>).map(ContactReferenceSchemaFromJSON)),
        'sourceMetadata': json['sourceMetadata'],
        'holdings': json['holdings'] == null ? undefined : ((json['holdings'] as Array<any>).map(HoldingSchemaFromJSON)),
    };
}

export function InvestmentAccountSchemaToJSON(json: any): InvestmentAccountSchema {
    return InvestmentAccountSchemaToJSONTyped(json, false);
}

export function InvestmentAccountSchemaToJSONTyped(value?: InvestmentAccountSchema | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'uniqueIdentifier': value['uniqueIdentifier'],
        'externalIdentifier': value['externalIdentifier'],
        'accountNumber': value['accountNumber'],
        'status': InvestmentStatusToJSON(value['status']),
        'description': value['description'],
        'accountType': AccountTypeToJSON(value['accountType']),
        'jurisdiction': value['jurisdiction'],
        'registrationType': RegistrationTypeToJSON(value['registrationType']),
        'currency': value['currency'],
        'marketValue': value['marketValue'],
        'fetchedAt': value['fetchedAt'] == null ? value['fetchedAt'] : value['fetchedAt'].toISOString().substring(0,10),
        'asOfDate': value['asOfDate'] == null ? value['asOfDate'] : value['asOfDate'].toISOString().substring(0,10),
        'owners': value['owners'] == null ? undefined : ((value['owners'] as Array<any>).map(ContactReferenceSchemaToJSON)),
        'contributors': value['contributors'] == null ? undefined : ((value['contributors'] as Array<any>).map(ContactReferenceSchemaToJSON)),
        'sourceMetadata': value['sourceMetadata'],
        'holdings': value['holdings'] == null ? undefined : ((value['holdings'] as Array<any>).map(HoldingSchemaToJSON)),
    };
}

