/* 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 { PolicyEngineMode } from './PolicyEngineMode';
import {
    PolicyEngineModeFromJSON,
    PolicyEngineModeFromJSONTyped,
    PolicyEngineModeToJSON,
    PolicyEngineModeToJSONTyped,
} from './PolicyEngineMode';
import type { Provider } from './Provider';
import {
    ProviderFromJSON,
    ProviderFromJSONTyped,
    ProviderToJSON,
    ProviderToJSONTyped,
} from './Provider';

/**
 * Application Serializer
 * @export
 * @interface Application
 */
export interface Application {
    /**
     * 
     * @type {string}
     * @memberof Application
     */
    readonly pk: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof Application
     */
    name: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof Application
     */
    slug: string;
    /**
     * 
     * @type {number}
     * @memberof Application
     */
    provider?: number | null;
    /**
     * 
     * @type {Provider}
     * @memberof Application
     */
    readonly providerObj: Provider;
    /**
     * 
     * @type {Array<number>}
     * @memberof Application
     */
    backchannelProviders?: Array<number>;
    /**
     * 
     * @type {Array<Provider>}
     * @memberof Application
     */
    readonly backchannelProvidersObj: Array<Provider>;
    /**
     * Allow formatting of launch URL
     * @type {string}
     * @memberof Application
     */
    readonly launchUrl: string | null;
    /**
     * Open launch URL in a new browser tab or window.
     * @type {boolean}
     * @memberof Application
     */
    openInNewTab?: boolean;
    /**
     * 
     * @type {string}
     * @memberof Application
     */
    metaLaunchUrl?: string;
    /**
     * Get the URL to the App Icon image. If the name is /static or starts with http
     * it is returned as-is
     * @type {string}
     * @memberof Application
     */
    readonly metaIcon: string | null;
    /**
     * 
     * @type {string}
     * @memberof Application
     */
    metaDescription?: string;
    /**
     * 
     * @type {string}
     * @memberof Application
     */
    metaPublisher?: string;
    /**
     * 
     * @type {PolicyEngineMode}
     * @memberof Application
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * 
     * @type {string}
     * @memberof Application
     */
    group?: string;
}



/**
 * Check if a given object implements the Application interface.
 */
export function instanceOfApplication(value: object): value is Application {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('slug' in value) || value['slug'] === undefined) return false;
    if (!('providerObj' in value) || value['providerObj'] === undefined) return false;
    if (!('backchannelProvidersObj' in value) || value['backchannelProvidersObj'] === undefined) return false;
    if (!('launchUrl' in value) || value['launchUrl'] === undefined) return false;
    if (!('metaIcon' in value) || value['metaIcon'] === undefined) return false;
    return true;
}

export function ApplicationFromJSON(json: any): Application {
    return ApplicationFromJSONTyped(json, false);
}

export function ApplicationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Application {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'slug': json['slug'],
        'provider': json['provider'] == null ? undefined : json['provider'],
        'providerObj': ProviderFromJSON(json['provider_obj']),
        'backchannelProviders': json['backchannel_providers'] == null ? undefined : json['backchannel_providers'],
        'backchannelProvidersObj': ((json['backchannel_providers_obj'] as Array<any>).map(ProviderFromJSON)),
        'launchUrl': json['launch_url'],
        'openInNewTab': json['open_in_new_tab'] == null ? undefined : json['open_in_new_tab'],
        'metaLaunchUrl': json['meta_launch_url'] == null ? undefined : json['meta_launch_url'],
        'metaIcon': json['meta_icon'],
        'metaDescription': json['meta_description'] == null ? undefined : json['meta_description'],
        'metaPublisher': json['meta_publisher'] == null ? undefined : json['meta_publisher'],
        'policyEngineMode': json['policy_engine_mode'] == null ? undefined : PolicyEngineModeFromJSON(json['policy_engine_mode']),
        'group': json['group'] == null ? undefined : json['group'],
    };
}

export function ApplicationToJSON(json: any): Application {
    return ApplicationToJSONTyped(json, false);
}

export function ApplicationToJSONTyped(value?: Omit<Application, 'pk'|'provider_obj'|'backchannel_providers_obj'|'launch_url'|'meta_icon'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'slug': value['slug'],
        'provider': value['provider'],
        'backchannel_providers': value['backchannelProviders'],
        'open_in_new_tab': value['openInNewTab'],
        'meta_launch_url': value['metaLaunchUrl'],
        'meta_description': value['metaDescription'],
        'meta_publisher': value['metaPublisher'],
        'policy_engine_mode': PolicyEngineModeToJSON(value['policyEngineMode']),
        'group': value['group'],
    };
}

