/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.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 type { AuthorizationCodeAuthMethodEnum } from "./AuthorizationCodeAuthMethodEnum";
import {
    AuthorizationCodeAuthMethodEnumFromJSON,
    AuthorizationCodeAuthMethodEnumToJSON,
} from "./AuthorizationCodeAuthMethodEnum";
import type { GroupMatchingModeEnum } from "./GroupMatchingModeEnum";
import {
    GroupMatchingModeEnumFromJSON,
    GroupMatchingModeEnumToJSON,
} from "./GroupMatchingModeEnum";
import type { PKCEMethodEnum } from "./PKCEMethodEnum";
import { PKCEMethodEnumFromJSON, PKCEMethodEnumToJSON } from "./PKCEMethodEnum";
import type { PolicyEngineMode } from "./PolicyEngineMode";
import { PolicyEngineModeFromJSON, PolicyEngineModeToJSON } from "./PolicyEngineMode";
import type { ProviderTypeEnum } from "./ProviderTypeEnum";
import { ProviderTypeEnumFromJSON, ProviderTypeEnumToJSON } from "./ProviderTypeEnum";
import type { UserMatchingModeEnum } from "./UserMatchingModeEnum";
import { UserMatchingModeEnumFromJSON, UserMatchingModeEnumToJSON } from "./UserMatchingModeEnum";

/**
 * OAuth Source Serializer
 * @export
 * @interface PatchedOAuthSourceRequest
 */
export interface PatchedOAuthSourceRequest {
    /**
     * Source's display Name.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    name?: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    slug?: string;
    /**
     *
     * @type {boolean}
     * @memberof PatchedOAuthSourceRequest
     */
    enabled?: boolean;
    /**
     * When enabled, this source will be displayed as a prominent button on the login page, instead of a small icon.
     * @type {boolean}
     * @memberof PatchedOAuthSourceRequest
     */
    promoted?: boolean;
    /**
     * Flow to use when authenticating existing users.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    authenticationFlow?: string | null;
    /**
     * Flow to use when enrolling new users.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    enrollmentFlow?: string | null;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedOAuthSourceRequest
     */
    userPropertyMappings?: Array<string>;
    /**
     *
     * @type {Array<string>}
     * @memberof PatchedOAuthSourceRequest
     */
    groupPropertyMappings?: Array<string>;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof PatchedOAuthSourceRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * How the source determines if an existing user should be authenticated or a new user enrolled.
     * @type {UserMatchingModeEnum}
     * @memberof PatchedOAuthSourceRequest
     */
    userMatchingMode?: UserMatchingModeEnum;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    userPathTemplate?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    icon?: string;
    /**
     * How the source determines if an existing group should be used or a new group created.
     * @type {GroupMatchingModeEnum}
     * @memberof PatchedOAuthSourceRequest
     */
    groupMatchingMode?: GroupMatchingModeEnum;
    /**
     *
     * @type {ProviderTypeEnum}
     * @memberof PatchedOAuthSourceRequest
     */
    providerType?: ProviderTypeEnum;
    /**
     * URL used to request the initial token. This URL is only required for OAuth 1.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    requestTokenUrl?: string | null;
    /**
     * URL the user is redirect to to conest the flow.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    authorizationUrl?: string | null;
    /**
     * URL used by authentik to retrieve tokens.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    accessTokenUrl?: string | null;
    /**
     * URL used by authentik to get user information.
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    profileUrl?: string | null;
    /**
     *
     * @type {PKCEMethodEnum}
     * @memberof PatchedOAuthSourceRequest
     */
    pkce?: PKCEMethodEnum;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    consumerKey?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    consumerSecret?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    additionalScopes?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    oidcWellKnownUrl?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedOAuthSourceRequest
     */
    oidcJwksUrl?: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof PatchedOAuthSourceRequest
     */
    oidcJwks?: { [key: string]: any };
    /**
     * How to perform authentication during an authorization_code token request flow
     * @type {AuthorizationCodeAuthMethodEnum}
     * @memberof PatchedOAuthSourceRequest
     */
    authorizationCodeAuthMethod?: AuthorizationCodeAuthMethodEnum;
}

/**
 * Check if a given object implements the PatchedOAuthSourceRequest interface.
 */
export function instanceOfPatchedOAuthSourceRequest(
    value: object,
): value is PatchedOAuthSourceRequest {
    return true;
}

export function PatchedOAuthSourceRequestFromJSON(json: any): PatchedOAuthSourceRequest {
    return PatchedOAuthSourceRequestFromJSONTyped(json, false);
}

export function PatchedOAuthSourceRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedOAuthSourceRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"] == null ? undefined : json["name"],
        slug: json["slug"] == null ? undefined : json["slug"],
        enabled: json["enabled"] == null ? undefined : json["enabled"],
        promoted: json["promoted"] == null ? undefined : json["promoted"],
        authenticationFlow:
            json["authentication_flow"] == null ? undefined : json["authentication_flow"],
        enrollmentFlow: json["enrollment_flow"] == null ? undefined : json["enrollment_flow"],
        userPropertyMappings:
            json["user_property_mappings"] == null ? undefined : json["user_property_mappings"],
        groupPropertyMappings:
            json["group_property_mappings"] == null ? undefined : json["group_property_mappings"],
        policyEngineMode:
            json["policy_engine_mode"] == null
                ? undefined
                : PolicyEngineModeFromJSON(json["policy_engine_mode"]),
        userMatchingMode:
            json["user_matching_mode"] == null
                ? undefined
                : UserMatchingModeEnumFromJSON(json["user_matching_mode"]),
        userPathTemplate:
            json["user_path_template"] == null ? undefined : json["user_path_template"],
        icon: json["icon"] == null ? undefined : json["icon"],
        groupMatchingMode:
            json["group_matching_mode"] == null
                ? undefined
                : GroupMatchingModeEnumFromJSON(json["group_matching_mode"]),
        providerType:
            json["provider_type"] == null
                ? undefined
                : ProviderTypeEnumFromJSON(json["provider_type"]),
        requestTokenUrl: json["request_token_url"] == null ? undefined : json["request_token_url"],
        authorizationUrl: json["authorization_url"] == null ? undefined : json["authorization_url"],
        accessTokenUrl: json["access_token_url"] == null ? undefined : json["access_token_url"],
        profileUrl: json["profile_url"] == null ? undefined : json["profile_url"],
        pkce: json["pkce"] == null ? undefined : PKCEMethodEnumFromJSON(json["pkce"]),
        consumerKey: json["consumer_key"] == null ? undefined : json["consumer_key"],
        consumerSecret: json["consumer_secret"] == null ? undefined : json["consumer_secret"],
        additionalScopes: json["additional_scopes"] == null ? undefined : json["additional_scopes"],
        oidcWellKnownUrl:
            json["oidc_well_known_url"] == null ? undefined : json["oidc_well_known_url"],
        oidcJwksUrl: json["oidc_jwks_url"] == null ? undefined : json["oidc_jwks_url"],
        oidcJwks: json["oidc_jwks"] == null ? undefined : json["oidc_jwks"],
        authorizationCodeAuthMethod:
            json["authorization_code_auth_method"] == null
                ? undefined
                : AuthorizationCodeAuthMethodEnumFromJSON(json["authorization_code_auth_method"]),
    };
}

export function PatchedOAuthSourceRequestToJSON(json: any): PatchedOAuthSourceRequest {
    return PatchedOAuthSourceRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        slug: value["slug"],
        enabled: value["enabled"],
        promoted: value["promoted"],
        authentication_flow: value["authenticationFlow"],
        enrollment_flow: value["enrollmentFlow"],
        user_property_mappings: value["userPropertyMappings"],
        group_property_mappings: value["groupPropertyMappings"],
        policy_engine_mode: PolicyEngineModeToJSON(value["policyEngineMode"]),
        user_matching_mode: UserMatchingModeEnumToJSON(value["userMatchingMode"]),
        user_path_template: value["userPathTemplate"],
        icon: value["icon"],
        group_matching_mode: GroupMatchingModeEnumToJSON(value["groupMatchingMode"]),
        provider_type: ProviderTypeEnumToJSON(value["providerType"]),
        request_token_url: value["requestTokenUrl"],
        authorization_url: value["authorizationUrl"],
        access_token_url: value["accessTokenUrl"],
        profile_url: value["profileUrl"],
        pkce: PKCEMethodEnumToJSON(value["pkce"]),
        consumer_key: value["consumerKey"],
        consumer_secret: value["consumerSecret"],
        additional_scopes: value["additionalScopes"],
        oidc_well_known_url: value["oidcWellKnownUrl"],
        oidc_jwks_url: value["oidcJwksUrl"],
        oidc_jwks: value["oidcJwks"],
        authorization_code_auth_method: AuthorizationCodeAuthMethodEnumToJSON(
            value["authorizationCodeAuthMethod"],
        ),
    };
}
