/* 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 { Token } from "./Token";
import { TokenFromJSON } from "./Token";

/**
 * SCIMSource Serializer
 * @export
 * @interface SCIMSource
 */
export interface SCIMSource {
    /**
     *
     * @type {string}
     * @memberof SCIMSource
     */
    readonly pk: string;
    /**
     * Source's display Name.
     * @type {string}
     * @memberof SCIMSource
     */
    name: string;
    /**
     * Internal source name, used in URLs.
     * @type {string}
     * @memberof SCIMSource
     */
    slug: string;
    /**
     *
     * @type {boolean}
     * @memberof SCIMSource
     */
    enabled?: boolean;
    /**
     *
     * @type {Array<string>}
     * @memberof SCIMSource
     */
    userPropertyMappings?: Array<string>;
    /**
     *
     * @type {Array<string>}
     * @memberof SCIMSource
     */
    groupPropertyMappings?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof SCIMSource
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof SCIMSource
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof SCIMSource
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof SCIMSource
     */
    readonly metaModelName: string;
    /**
     * Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
     * @type {string}
     * @memberof SCIMSource
     */
    readonly managed: string | null;
    /**
     *
     * @type {string}
     * @memberof SCIMSource
     */
    userPathTemplate?: string;
    /**
     * Get Root URL
     * @type {string}
     * @memberof SCIMSource
     */
    readonly rootUrl: string;
    /**
     *
     * @type {Token}
     * @memberof SCIMSource
     */
    readonly tokenObj: Token;
}

/**
 * Check if a given object implements the SCIMSource interface.
 */
export function instanceOfSCIMSource(value: object): value is SCIMSource {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("slug" in value) || value["slug"] === undefined) return false;
    if (!("component" in value) || value["component"] === 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 (!("managed" in value) || value["managed"] === undefined) return false;
    if (!("rootUrl" in value) || value["rootUrl"] === undefined) return false;
    if (!("tokenObj" in value) || value["tokenObj"] === undefined) return false;
    return true;
}

export function SCIMSourceFromJSON(json: any): SCIMSource {
    return SCIMSourceFromJSONTyped(json, false);
}

export function SCIMSourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): SCIMSource {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        slug: json["slug"],
        enabled: json["enabled"] == null ? undefined : json["enabled"],
        userPropertyMappings:
            json["user_property_mappings"] == null ? undefined : json["user_property_mappings"],
        groupPropertyMappings:
            json["group_property_mappings"] == null ? undefined : json["group_property_mappings"],
        component: json["component"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        managed: json["managed"],
        userPathTemplate:
            json["user_path_template"] == null ? undefined : json["user_path_template"],
        rootUrl: json["root_url"],
        tokenObj: TokenFromJSON(json["token_obj"]),
    };
}

export function SCIMSourceToJSON(json: any): SCIMSource {
    return SCIMSourceToJSONTyped(json, false);
}

export function SCIMSourceToJSONTyped(
    value?: Omit<
        SCIMSource,
        | "pk"
        | "component"
        | "verbose_name"
        | "verbose_name_plural"
        | "meta_model_name"
        | "managed"
        | "root_url"
        | "token_obj"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        slug: value["slug"],
        enabled: value["enabled"],
        user_property_mappings: value["userPropertyMappings"],
        group_property_mappings: value["groupPropertyMappings"],
        user_path_template: value["userPathTemplate"],
    };
}
