/* 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 { OutgoingSyncDeleteAction } from "./OutgoingSyncDeleteAction";
import {
    OutgoingSyncDeleteActionFromJSON,
    OutgoingSyncDeleteActionToJSON,
} from "./OutgoingSyncDeleteAction";

/**
 * MicrosoftEntraProvider Serializer
 * @export
 * @interface MicrosoftEntraProvider
 */
export interface MicrosoftEntraProvider {
    /**
     *
     * @type {number}
     * @memberof MicrosoftEntraProvider
     */
    readonly pk: number;
    /**
     *
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    name: string;
    /**
     *
     * @type {Array<string>}
     * @memberof MicrosoftEntraProvider
     */
    propertyMappings?: Array<string>;
    /**
     * Property mappings used for group creation/updating.
     * @type {Array<string>}
     * @memberof MicrosoftEntraProvider
     */
    propertyMappingsGroup?: Array<string>;
    /**
     * Get object component so that we know how to edit the object
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly component: string;
    /**
     * Internal application name, used in URLs.
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly assignedBackchannelApplicationSlug: string | null;
    /**
     * Application's display Name.
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly assignedBackchannelApplicationName: string | null;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    readonly metaModelName: string;
    /**
     *
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    clientId: string;
    /**
     *
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    clientSecret: string;
    /**
     *
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    tenantId: string;
    /**
     *
     * @type {boolean}
     * @memberof MicrosoftEntraProvider
     */
    excludeUsersServiceAccount?: boolean;
    /**
     *
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    filterGroup?: string | null;
    /**
     *
     * @type {OutgoingSyncDeleteAction}
     * @memberof MicrosoftEntraProvider
     */
    userDeleteAction?: OutgoingSyncDeleteAction;
    /**
     *
     * @type {OutgoingSyncDeleteAction}
     * @memberof MicrosoftEntraProvider
     */
    groupDeleteAction?: OutgoingSyncDeleteAction;
    /**
     * Controls the number of objects synced in a single task
     * @type {number}
     * @memberof MicrosoftEntraProvider
     */
    syncPageSize?: number;
    /**
     * Timeout for synchronization of a single page
     * @type {string}
     * @memberof MicrosoftEntraProvider
     */
    syncPageTimeout?: string;
    /**
     * When enabled, provider will not modify or create objects in the remote system.
     * @type {boolean}
     * @memberof MicrosoftEntraProvider
     */
    dryRun?: boolean;
}

/**
 * Check if a given object implements the MicrosoftEntraProvider interface.
 */
export function instanceOfMicrosoftEntraProvider(value: object): value is MicrosoftEntraProvider {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("component" in value) || value["component"] === undefined) return false;
    if (
        !("assignedBackchannelApplicationSlug" in value) ||
        value["assignedBackchannelApplicationSlug"] === undefined
    )
        return false;
    if (
        !("assignedBackchannelApplicationName" in value) ||
        value["assignedBackchannelApplicationName"] === 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 (!("clientId" in value) || value["clientId"] === undefined) return false;
    if (!("clientSecret" in value) || value["clientSecret"] === undefined) return false;
    if (!("tenantId" in value) || value["tenantId"] === undefined) return false;
    return true;
}

export function MicrosoftEntraProviderFromJSON(json: any): MicrosoftEntraProvider {
    return MicrosoftEntraProviderFromJSONTyped(json, false);
}

export function MicrosoftEntraProviderFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): MicrosoftEntraProvider {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        propertyMappings: json["property_mappings"] == null ? undefined : json["property_mappings"],
        propertyMappingsGroup:
            json["property_mappings_group"] == null ? undefined : json["property_mappings_group"],
        component: json["component"],
        assignedBackchannelApplicationSlug: json["assigned_backchannel_application_slug"],
        assignedBackchannelApplicationName: json["assigned_backchannel_application_name"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        clientId: json["client_id"],
        clientSecret: json["client_secret"],
        tenantId: json["tenant_id"],
        excludeUsersServiceAccount:
            json["exclude_users_service_account"] == null
                ? undefined
                : json["exclude_users_service_account"],
        filterGroup: json["filter_group"] == null ? undefined : json["filter_group"],
        userDeleteAction:
            json["user_delete_action"] == null
                ? undefined
                : OutgoingSyncDeleteActionFromJSON(json["user_delete_action"]),
        groupDeleteAction:
            json["group_delete_action"] == null
                ? undefined
                : OutgoingSyncDeleteActionFromJSON(json["group_delete_action"]),
        syncPageSize: json["sync_page_size"] == null ? undefined : json["sync_page_size"],
        syncPageTimeout: json["sync_page_timeout"] == null ? undefined : json["sync_page_timeout"],
        dryRun: json["dry_run"] == null ? undefined : json["dry_run"],
    };
}

export function MicrosoftEntraProviderToJSON(json: any): MicrosoftEntraProvider {
    return MicrosoftEntraProviderToJSONTyped(json, false);
}

export function MicrosoftEntraProviderToJSONTyped(
    value?: Omit<
        MicrosoftEntraProvider,
        | "pk"
        | "component"
        | "assigned_backchannel_application_slug"
        | "assigned_backchannel_application_name"
        | "verbose_name"
        | "verbose_name_plural"
        | "meta_model_name"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        property_mappings: value["propertyMappings"],
        property_mappings_group: value["propertyMappingsGroup"],
        client_id: value["clientId"],
        client_secret: value["clientSecret"],
        tenant_id: value["tenantId"],
        exclude_users_service_account: value["excludeUsersServiceAccount"],
        filter_group: value["filterGroup"],
        user_delete_action: OutgoingSyncDeleteActionToJSON(value["userDeleteAction"]),
        group_delete_action: OutgoingSyncDeleteActionToJSON(value["groupDeleteAction"]),
        sync_page_size: value["syncPageSize"],
        sync_page_timeout: value["syncPageTimeout"],
        dry_run: value["dryRun"],
    };
}
