/* 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 { OpenIDConnectConfiguration } from "./OpenIDConnectConfiguration";
import { OpenIDConnectConfigurationFromJSON } from "./OpenIDConnectConfiguration";
import type { ProxyMode } from "./ProxyMode";
import { ProxyModeFromJSON, ProxyModeToJSON } from "./ProxyMode";

/**
 * Proxy provider serializer for outposts
 * @export
 * @interface ProxyOutpostConfig
 */
export interface ProxyOutpostConfig {
    /**
     *
     * @type {number}
     * @memberof ProxyOutpostConfig
     */
    readonly pk: number;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    name: string;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    internalHost?: string;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    externalHost: string;
    /**
     * Validate SSL Certificates of upstream servers
     * @type {boolean}
     * @memberof ProxyOutpostConfig
     */
    internalHostSslValidation?: boolean;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    clientId?: string;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    clientSecret?: string;
    /**
     *
     * @type {OpenIDConnectConfiguration}
     * @memberof ProxyOutpostConfig
     */
    readonly oidcConfiguration: OpenIDConnectConfiguration;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    cookieSecret?: string;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    certificate?: string | null;
    /**
     * Regular expressions for which authentication is not required. Each new line is interpreted as a new Regular Expression.
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    skipPathRegex?: string;
    /**
     * Set a custom HTTP-Basic Authentication header based on values from authentik.
     * @type {boolean}
     * @memberof ProxyOutpostConfig
     */
    basicAuthEnabled?: boolean;
    /**
     * User/Group Attribute used for the password part of the HTTP-Basic Header.
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    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 ProxyOutpostConfig
     */
    basicAuthUserAttribute?: string;
    /**
     * Enable support for forwardAuth in traefik and nginx auth_request. Exclusive with internal_host.
     * @type {ProxyMode}
     * @memberof ProxyOutpostConfig
     */
    mode?: ProxyMode;
    /**
     *
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    cookieDomain?: string;
    /**
     * Get token validity as second count
     * @type {number}
     * @memberof ProxyOutpostConfig
     */
    readonly accessTokenValidity: number | null;
    /**
     * When enabled, this provider will intercept the authorization header and authenticate requests based on its value.
     * @type {boolean}
     * @memberof ProxyOutpostConfig
     */
    interceptHeaderAuth?: boolean;
    /**
     * Get all the scope names the outpost should request,
     * including custom-defined ones
     * @type {Array<string>}
     * @memberof ProxyOutpostConfig
     */
    readonly scopesToRequest: Array<string>;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    readonly assignedApplicationSlug: string;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof ProxyOutpostConfig
     */
    readonly assignedApplicationName: string;
}

/**
 * Check if a given object implements the ProxyOutpostConfig interface.
 */
export function instanceOfProxyOutpostConfig(value: object): value is ProxyOutpostConfig {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("externalHost" in value) || value["externalHost"] === undefined) return false;
    if (!("oidcConfiguration" in value) || value["oidcConfiguration"] === undefined) return false;
    if (!("accessTokenValidity" in value) || value["accessTokenValidity"] === undefined)
        return false;
    if (!("scopesToRequest" in value) || value["scopesToRequest"] === undefined) return false;
    if (!("assignedApplicationSlug" in value) || value["assignedApplicationSlug"] === undefined)
        return false;
    if (!("assignedApplicationName" in value) || value["assignedApplicationName"] === undefined)
        return false;
    return true;
}

export function ProxyOutpostConfigFromJSON(json: any): ProxyOutpostConfig {
    return ProxyOutpostConfigFromJSONTyped(json, false);
}

export function ProxyOutpostConfigFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): ProxyOutpostConfig {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        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"],
        clientId: json["client_id"] == null ? undefined : json["client_id"],
        clientSecret: json["client_secret"] == null ? undefined : json["client_secret"],
        oidcConfiguration: OpenIDConnectConfigurationFromJSON(json["oidc_configuration"]),
        cookieSecret: json["cookie_secret"] == null ? undefined : json["cookie_secret"],
        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"]),
        cookieDomain: json["cookie_domain"] == null ? undefined : json["cookie_domain"],
        accessTokenValidity: json["access_token_validity"],
        interceptHeaderAuth:
            json["intercept_header_auth"] == null ? undefined : json["intercept_header_auth"],
        scopesToRequest: json["scopes_to_request"],
        assignedApplicationSlug: json["assigned_application_slug"],
        assignedApplicationName: json["assigned_application_name"],
    };
}

export function ProxyOutpostConfigToJSON(json: any): ProxyOutpostConfig {
    return ProxyOutpostConfigToJSONTyped(json, false);
}

export function ProxyOutpostConfigToJSONTyped(
    value?: Omit<
        ProxyOutpostConfig,
        | "pk"
        | "oidc_configuration"
        | "access_token_validity"
        | "scopes_to_request"
        | "assigned_application_slug"
        | "assigned_application_name"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        internal_host: value["internalHost"],
        external_host: value["externalHost"],
        internal_host_ssl_validation: value["internalHostSslValidation"],
        client_id: value["clientId"],
        client_secret: value["clientSecret"],
        cookie_secret: value["cookieSecret"],
        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"]),
        cookie_domain: value["cookieDomain"],
        intercept_header_auth: value["interceptHeaderAuth"],
    };
}
