/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.6.4
 * 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 { RedirectURIRequest } from './RedirectURIRequest';
import {
    RedirectURIRequestFromJSON,
    RedirectURIRequestFromJSONTyped,
    RedirectURIRequestToJSON,
    RedirectURIRequestToJSONTyped,
} from './RedirectURIRequest';
import type { ClientTypeEnum } from './ClientTypeEnum';
import {
    ClientTypeEnumFromJSON,
    ClientTypeEnumFromJSONTyped,
    ClientTypeEnumToJSON,
    ClientTypeEnumToJSONTyped,
} from './ClientTypeEnum';
import type { SubModeEnum } from './SubModeEnum';
import {
    SubModeEnumFromJSON,
    SubModeEnumFromJSONTyped,
    SubModeEnumToJSON,
    SubModeEnumToJSONTyped,
} from './SubModeEnum';
import type { IssuerModeEnum } from './IssuerModeEnum';
import {
    IssuerModeEnumFromJSON,
    IssuerModeEnumFromJSONTyped,
    IssuerModeEnumToJSON,
    IssuerModeEnumToJSONTyped,
} from './IssuerModeEnum';

/**
 * OAuth2Provider Serializer
 * @export
 * @interface OAuth2ProviderRequest
 */
export interface OAuth2ProviderRequest {
    /**
     * 
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    name: string;
    /**
     * Flow used for authentication when the associated application is accessed by an un-authenticated user.
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow used when authorizing this provider.
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    authorizationFlow: string;
    /**
     * Flow used ending the session from a provider.
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    invalidationFlow: string;
    /**
     * 
     * @type {Array<string>}
     * @memberof OAuth2ProviderRequest
     */
    propertyMappings?: Array<string>;
    /**
     * Confidential clients are capable of maintaining the confidentiality of their credentials. Public clients are incapable
     * @type {ClientTypeEnum}
     * @memberof OAuth2ProviderRequest
     */
    clientType?: ClientTypeEnum;
    /**
     * 
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    clientId?: string;
    /**
     * 
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    clientSecret?: string;
    /**
     * Access codes not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    accessCodeValidity?: string;
    /**
     * Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    accessTokenValidity?: string;
    /**
     * Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    refreshTokenValidity?: string;
    /**
     * Include User claims from scopes in the id_token, for applications that don't access the userinfo endpoint.
     * @type {boolean}
     * @memberof OAuth2ProviderRequest
     */
    includeClaimsInIdToken?: boolean;
    /**
     * Key used to sign the tokens.
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    signingKey?: string | null;
    /**
     * Key used to encrypt the tokens. When set, tokens will be encrypted and returned as JWEs.
     * @type {string}
     * @memberof OAuth2ProviderRequest
     */
    encryptionKey?: string | null;
    /**
     * 
     * @type {Array<RedirectURIRequest>}
     * @memberof OAuth2ProviderRequest
     */
    redirectUris: Array<RedirectURIRequest>;
    /**
     * Configure what data should be used as unique User Identifier. For most cases, the default should be fine.
     * @type {SubModeEnum}
     * @memberof OAuth2ProviderRequest
     */
    subMode?: SubModeEnum;
    /**
     * Configure how the issuer field of the ID Token should be filled.
     * @type {IssuerModeEnum}
     * @memberof OAuth2ProviderRequest
     */
    issuerMode?: IssuerModeEnum;
    /**
     * 
     * @type {Array<string>}
     * @memberof OAuth2ProviderRequest
     */
    jwtFederationSources?: Array<string>;
    /**
     * 
     * @type {Array<number>}
     * @memberof OAuth2ProviderRequest
     */
    jwtFederationProviders?: Array<number>;
}



/**
 * Check if a given object implements the OAuth2ProviderRequest interface.
 */
export function instanceOfOAuth2ProviderRequest(value: object): value is OAuth2ProviderRequest {
    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 (!('redirectUris' in value) || value['redirectUris'] === undefined) return false;
    return true;
}

export function OAuth2ProviderRequestFromJSON(json: any): OAuth2ProviderRequest {
    return OAuth2ProviderRequestFromJSONTyped(json, false);
}

export function OAuth2ProviderRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): OAuth2ProviderRequest {
    if (json == null) {
        return json;
    }
    return {
        
        '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'],
        'clientType': json['client_type'] == null ? undefined : ClientTypeEnumFromJSON(json['client_type']),
        'clientId': json['client_id'] == null ? undefined : json['client_id'],
        'clientSecret': json['client_secret'] == null ? undefined : json['client_secret'],
        'accessCodeValidity': json['access_code_validity'] == null ? undefined : json['access_code_validity'],
        'accessTokenValidity': json['access_token_validity'] == null ? undefined : json['access_token_validity'],
        'refreshTokenValidity': json['refresh_token_validity'] == null ? undefined : json['refresh_token_validity'],
        'includeClaimsInIdToken': json['include_claims_in_id_token'] == null ? undefined : json['include_claims_in_id_token'],
        'signingKey': json['signing_key'] == null ? undefined : json['signing_key'],
        'encryptionKey': json['encryption_key'] == null ? undefined : json['encryption_key'],
        'redirectUris': ((json['redirect_uris'] as Array<any>).map(RedirectURIRequestFromJSON)),
        'subMode': json['sub_mode'] == null ? undefined : SubModeEnumFromJSON(json['sub_mode']),
        'issuerMode': json['issuer_mode'] == null ? undefined : IssuerModeEnumFromJSON(json['issuer_mode']),
        'jwtFederationSources': json['jwt_federation_sources'] == null ? undefined : json['jwt_federation_sources'],
        'jwtFederationProviders': json['jwt_federation_providers'] == null ? undefined : json['jwt_federation_providers'],
    };
}

export function OAuth2ProviderRequestToJSON(json: any): OAuth2ProviderRequest {
    return OAuth2ProviderRequestToJSONTyped(json, false);
}

export function OAuth2ProviderRequestToJSONTyped(value?: OAuth2ProviderRequest | 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'],
        'client_type': ClientTypeEnumToJSON(value['clientType']),
        'client_id': value['clientId'],
        'client_secret': value['clientSecret'],
        'access_code_validity': value['accessCodeValidity'],
        'access_token_validity': value['accessTokenValidity'],
        'refresh_token_validity': value['refreshTokenValidity'],
        'include_claims_in_id_token': value['includeClaimsInIdToken'],
        'signing_key': value['signingKey'],
        'encryption_key': value['encryptionKey'],
        'redirect_uris': ((value['redirectUris'] as Array<any>).map(RedirectURIRequestToJSON)),
        'sub_mode': SubModeEnumToJSON(value['subMode']),
        'issuer_mode': IssuerModeEnumToJSON(value['issuerMode']),
        'jwt_federation_sources': value['jwtFederationSources'],
        'jwt_federation_providers': value['jwtFederationProviders'],
    };
}

