/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.0-rc1
 * Contact: hello@goauthentik.io
 *
 * 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 { ProviderModelEnum } from './ProviderModelEnum';
import {
    ProviderModelEnumFromJSON,
    ProviderModelEnumFromJSONTyped,
    ProviderModelEnumToJSON,
    ProviderModelEnumToJSONTyped,
} from './ProviderModelEnum';
import type { ModelRequest } from './ModelRequest';
import {
    ModelRequestFromJSON,
    ModelRequestFromJSONTyped,
    ModelRequestToJSON,
    ModelRequestToJSONTyped,
} from './ModelRequest';
import type { ApplicationRequest } from './ApplicationRequest';
import {
    ApplicationRequestFromJSON,
    ApplicationRequestFromJSONTyped,
    ApplicationRequestToJSON,
    ApplicationRequestToJSONTyped,
} from './ApplicationRequest';
import type { TransactionPolicyBindingRequest } from './TransactionPolicyBindingRequest';
import {
    TransactionPolicyBindingRequestFromJSON,
    TransactionPolicyBindingRequestFromJSONTyped,
    TransactionPolicyBindingRequestToJSON,
    TransactionPolicyBindingRequestToJSONTyped,
} from './TransactionPolicyBindingRequest';

/**
 * Serializer for creating a provider and an application in one transaction
 * @export
 * @interface TransactionApplicationRequest
 */
export interface TransactionApplicationRequest {
    /**
     * 
     * @type {ApplicationRequest}
     * @memberof TransactionApplicationRequest
     */
    app: ApplicationRequest;
    /**
     * 
     * @type {ProviderModelEnum}
     * @memberof TransactionApplicationRequest
     */
    providerModel: ProviderModelEnum;
    /**
     * 
     * @type {ModelRequest}
     * @memberof TransactionApplicationRequest
     */
    provider: ModelRequest;
    /**
     * 
     * @type {Array<TransactionPolicyBindingRequest>}
     * @memberof TransactionApplicationRequest
     */
    policyBindings?: Array<TransactionPolicyBindingRequest>;
}



/**
 * Check if a given object implements the TransactionApplicationRequest interface.
 */
export function instanceOfTransactionApplicationRequest(value: object): value is TransactionApplicationRequest {
    if (!('app' in value) || value['app'] === undefined) return false;
    if (!('providerModel' in value) || value['providerModel'] === undefined) return false;
    if (!('provider' in value) || value['provider'] === undefined) return false;
    return true;
}

export function TransactionApplicationRequestFromJSON(json: any): TransactionApplicationRequest {
    return TransactionApplicationRequestFromJSONTyped(json, false);
}

export function TransactionApplicationRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionApplicationRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'app': ApplicationRequestFromJSON(json['app']),
        'providerModel': ProviderModelEnumFromJSON(json['provider_model']),
        'provider': ModelRequestFromJSON(json['provider']),
        'policyBindings': json['policy_bindings'] == null ? undefined : ((json['policy_bindings'] as Array<any>).map(TransactionPolicyBindingRequestFromJSON)),
    };
}

export function TransactionApplicationRequestToJSON(json: any): TransactionApplicationRequest {
    return TransactionApplicationRequestToJSONTyped(json, false);
}

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

    return {
        
        'app': ApplicationRequestToJSON(value['app']),
        'provider_model': ProviderModelEnumToJSON(value['providerModel']),
        'provider': ModelRequestToJSON(value['provider']),
        'policy_bindings': value['policyBindings'] == null ? undefined : ((value['policyBindings'] as Array<any>).map(TransactionPolicyBindingRequestToJSON)),
    };
}

