/* 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 { CapabilitiesEnum } from "./CapabilitiesEnum";
import { CapabilitiesEnumFromJSON, CapabilitiesEnumToJSON } from "./CapabilitiesEnum";
import type { ErrorReportingConfig } from "./ErrorReportingConfig";
import { ErrorReportingConfigFromJSON, ErrorReportingConfigToJSON } from "./ErrorReportingConfig";

/**
 * Serialize authentik Config into DRF Object
 * @export
 * @interface Config
 */
export interface Config {
    /**
     *
     * @type {ErrorReportingConfig}
     * @memberof Config
     */
    errorReporting: ErrorReportingConfig;
    /**
     *
     * @type {Array<CapabilitiesEnum>}
     * @memberof Config
     */
    capabilities: Array<CapabilitiesEnum>;
    /**
     *
     * @type {number}
     * @memberof Config
     */
    cacheTimeout: number;
    /**
     *
     * @type {number}
     * @memberof Config
     */
    cacheTimeoutFlows: number;
    /**
     *
     * @type {number}
     * @memberof Config
     */
    cacheTimeoutPolicies: number;
}

/**
 * Check if a given object implements the Config interface.
 */
export function instanceOfConfig(value: object): value is Config {
    if (!("errorReporting" in value) || value["errorReporting"] === undefined) return false;
    if (!("capabilities" in value) || value["capabilities"] === undefined) return false;
    if (!("cacheTimeout" in value) || value["cacheTimeout"] === undefined) return false;
    if (!("cacheTimeoutFlows" in value) || value["cacheTimeoutFlows"] === undefined) return false;
    if (!("cacheTimeoutPolicies" in value) || value["cacheTimeoutPolicies"] === undefined)
        return false;
    return true;
}

export function ConfigFromJSON(json: any): Config {
    return ConfigFromJSONTyped(json, false);
}

export function ConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): Config {
    if (json == null) {
        return json;
    }
    return {
        errorReporting: ErrorReportingConfigFromJSON(json["error_reporting"]),
        capabilities: (json["capabilities"] as Array<any>).map(CapabilitiesEnumFromJSON),
        cacheTimeout: json["cache_timeout"],
        cacheTimeoutFlows: json["cache_timeout_flows"],
        cacheTimeoutPolicies: json["cache_timeout_policies"],
    };
}

export function ConfigToJSON(json: any): Config {
    return ConfigToJSONTyped(json, false);
}

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

    return {
        error_reporting: ErrorReportingConfigToJSON(value["errorReporting"]),
        capabilities: (value["capabilities"] as Array<any>).map(CapabilitiesEnumToJSON),
        cache_timeout: value["cacheTimeout"],
        cache_timeout_flows: value["cacheTimeoutFlows"],
        cache_timeout_policies: value["cacheTimeoutPolicies"],
    };
}
