/* 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 { RedirectURI } from './RedirectURI';
import {
    RedirectURIFromJSON,
    RedirectURIFromJSONTyped,
    RedirectURIToJSON,
    RedirectURIToJSONTyped,
} from './RedirectURI';
import type { ProxyMode } from './ProxyMode';
import {
    ProxyModeFromJSON,
    ProxyModeFromJSONTyped,
    ProxyModeToJSON,
    ProxyModeToJSONTyped,
} from './ProxyMode';

/**
 * ProxyProvider Serializer
 * @export
 * @interface ProxyProvider
 */
export interface ProxyProvider {
    /**
     * 
     * @type {number}
     * @memberof ProxyProvider
     */
    readonly pk: number;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    name: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof ProxyProvider
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof ProxyProvider
     */
    authorizationFlow: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof ProxyProvider
     */
    invalidationFlow: string;
    /**
     * 
     * @type {Array<string>}
     * @memberof ProxyProvider
     */
    propertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly component: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly assignedApplicationSlug: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly assignedApplicationName: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly assignedBackchannelApplicationSlug: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly assignedBackchannelApplicationName: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly metaModelName: string;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    readonly clientId: string;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    internalHost?: string;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    externalHost: string;
    /**
     * Validate SSL Certificates of upstream servers
     * @type {boolean}
     * @memberof ProxyProvider
     */
    internalHostSslValidation?: boolean;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    certificate?: string | null;
    /**
     * Regular expressions for which authentication is not required. Each new line is interpreted as a new Regular Expression.
     * @type {string}
     * @memberof ProxyProvider
     */
    skipPathRegex?: string;
    /**
     * Set a custom HTTP-Basic Authentication header based on values from authentik.
     * @type {boolean}
     * @memberof ProxyProvider
     */
    basicAuthEnabled?: boolean;
    /**
     * User/Group Attribute used for the password part of the HTTP-Basic Header.
     * @type {string}
     * @memberof ProxyProvider
     */
    basicAuthPasswordAttribute?: string;
    /**
     * User/Group Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.
     * @type {string}
     * @memberof ProxyProvider
     */
    basicAuthUserAttribute?: string;
    /**
     * Enable support for forwardAuth in traefik and nginx auth_request. Exclusive with internal_host.
     * @type {ProxyMode}
     * @memberof ProxyProvider
     */
    mode?: ProxyMode;
    /**
     * When enabled, this provider will intercept the authorization header and authenticate requests based on its value.
     * @type {boolean}
     * @memberof ProxyProvider
     */
    interceptHeaderAuth?: boolean;
    /**
     * 
     * @type {Array<RedirectURI>}
     * @memberof ProxyProvider
     */
    readonly redirectUris: Array<RedirectURI>;
    /**
     * 
     * @type {string}
     * @memberof ProxyProvider
     */
    cookieDomain?: string;
    /**
     * 
     * @type {Array<string>}
     * @memberof ProxyProvider
     */
    jwtFederationSources?: Array<string>;
    /**
     * 
     * @type {Array<number>}
     * @memberof ProxyProvider
     */
    jwtFederationProviders?: Array<number>;
    /**
     * Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof ProxyProvider
     */
    accessTokenValidity?: string;
    /**
     * Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof ProxyProvider
     */
    refreshTokenValidity?: string;
    /**
     * 
     * @type {Array<string>}
     * @memberof ProxyProvider
     */
    readonly outpostSet: Array<string>;
}



/**
 * Check if a given object implements the ProxyProvider interface.
 */
export function instanceOfProxyProvider(value: object): value is ProxyProvider {
    if (!('pk' in value) || value['pk'] === undefined) return false;
    if (!('name' in value) || value['name'] === undefined) return false;
    if (!('authorizationFlow' in value) || value['authorizationFlow'] === undefined) return false;
    if (!('invalidationFlow' in value) || value['invalidationFlow'] === undefined) return false;
    if (!('component' in value) || value['component'] === undefined) return false;
    if (!('assignedApplicationSlug' in value) || value['assignedApplicationSlug'] === undefined) return false;
    if (!('assignedApplicationName' in value) || value['assignedApplicationName'] === undefined) return false;
    if (!('assignedBackchannelApplicationSlug' in value) || value['assignedBackchannelApplicationSlug'] === undefined) return false;
    if (!('assignedBackchannelApplicationName' in value) || value['assignedBackchannelApplicationName'] === undefined) return false;
    if (!('verboseName' in value) || value['verboseName'] === undefined) return false;
    if (!('verboseNamePlural' in value) || value['verboseNamePlural'] === undefined) return false;
    if (!('metaModelName' in value) || value['metaModelName'] === undefined) return false;
    if (!('clientId' in value) || value['clientId'] === undefined) return false;
    if (!('externalHost' in value) || value['externalHost'] === undefined) return false;
    if (!('redirectUris' in value) || value['redirectUris'] === undefined) return false;
    if (!('outpostSet' in value) || value['outpostSet'] === undefined) return false;
    return true;
}

export function ProxyProviderFromJSON(json: any): ProxyProvider {
    return ProxyProviderFromJSONTyped(json, false);
}

export function ProxyProviderFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProxyProvider {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'authenticationFlow': json['authentication_flow'] == null ? undefined : json['authentication_flow'],
        'authorizationFlow': json['authorization_flow'],
        'invalidationFlow': json['invalidation_flow'],
        'propertyMappings': json['property_mappings'] == null ? undefined : json['property_mappings'],
        'component': json['component'],
        'assignedApplicationSlug': json['assigned_application_slug'],
        'assignedApplicationName': json['assigned_application_name'],
        'assignedBackchannelApplicationSlug': json['assigned_backchannel_application_slug'],
        'assignedBackchannelApplicationName': json['assigned_backchannel_application_name'],
        'verboseName': json['verbose_name'],
        'verboseNamePlural': json['verbose_name_plural'],
        'metaModelName': json['meta_model_name'],
        'clientId': json['client_id'],
        'internalHost': json['internal_host'] == null ? undefined : json['internal_host'],
        'externalHost': json['external_host'],
        'internalHostSslValidation': json['internal_host_ssl_validation'] == null ? undefined : json['internal_host_ssl_validation'],
        'certificate': json['certificate'] == null ? undefined : json['certificate'],
        'skipPathRegex': json['skip_path_regex'] == null ? undefined : json['skip_path_regex'],
        'basicAuthEnabled': json['basic_auth_enabled'] == null ? undefined : json['basic_auth_enabled'],
        'basicAuthPasswordAttribute': json['basic_auth_password_attribute'] == null ? undefined : json['basic_auth_password_attribute'],
        'basicAuthUserAttribute': json['basic_auth_user_attribute'] == null ? undefined : json['basic_auth_user_attribute'],
        'mode': json['mode'] == null ? undefined : ProxyModeFromJSON(json['mode']),
        'interceptHeaderAuth': json['intercept_header_auth'] == null ? undefined : json['intercept_header_auth'],
        'redirectUris': ((json['redirect_uris'] as Array<any>).map(RedirectURIFromJSON)),
        'cookieDomain': json['cookie_domain'] == null ? undefined : json['cookie_domain'],
        'jwtFederationSources': json['jwt_federation_sources'] == null ? undefined : json['jwt_federation_sources'],
        'jwtFederationProviders': json['jwt_federation_providers'] == null ? undefined : json['jwt_federation_providers'],
        'accessTokenValidity': json['access_token_validity'] == null ? undefined : json['access_token_validity'],
        'refreshTokenValidity': json['refresh_token_validity'] == null ? undefined : json['refresh_token_validity'],
        'outpostSet': json['outpost_set'],
    };
}

export function ProxyProviderToJSON(json: any): ProxyProvider {
    return ProxyProviderToJSONTyped(json, false);
}

export function ProxyProviderToJSONTyped(value?: Omit<ProxyProvider, 'pk'|'component'|'assigned_application_slug'|'assigned_application_name'|'assigned_backchannel_application_slug'|'assigned_backchannel_application_name'|'verbose_name'|'verbose_name_plural'|'meta_model_name'|'client_id'|'redirect_uris'|'outpost_set'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'authentication_flow': value['authenticationFlow'],
        'authorization_flow': value['authorizationFlow'],
        'invalidation_flow': value['invalidationFlow'],
        'property_mappings': value['propertyMappings'],
        'internal_host': value['internalHost'],
        'external_host': value['externalHost'],
        'internal_host_ssl_validation': value['internalHostSslValidation'],
        'certificate': value['certificate'],
        'skip_path_regex': value['skipPathRegex'],
        'basic_auth_enabled': value['basicAuthEnabled'],
        'basic_auth_password_attribute': value['basicAuthPasswordAttribute'],
        'basic_auth_user_attribute': value['basicAuthUserAttribute'],
        'mode': ProxyModeToJSON(value['mode']),
        'intercept_header_auth': value['interceptHeaderAuth'],
        'cookie_domain': value['cookieDomain'],
        'jwt_federation_sources': value['jwtFederationSources'],
        'jwt_federation_providers': value['jwtFederationProviders'],
        'access_token_validity': value['accessTokenValidity'],
        'refresh_token_validity': value['refreshTokenValidity'],
    };
}

