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

/**
 * SCIMSourceUser Serializer
 * @export
 * @interface SCIMSourceUser
 */
export interface SCIMSourceUser {
    /**
     *
     * @type {string}
     * @memberof SCIMSourceUser
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof SCIMSourceUser
     */
    externalId: string;
    /**
     *
     * @type {number}
     * @memberof SCIMSourceUser
     */
    user: number;
    /**
     *
     * @type {PartialUser}
     * @memberof SCIMSourceUser
     */
    readonly userObj: PartialUser;
    /**
     *
     * @type {string}
     * @memberof SCIMSourceUser
     */
    source: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof SCIMSourceUser
     */
    attributes?: { [key: string]: any };
}

/**
 * Check if a given object implements the SCIMSourceUser interface.
 */
export function instanceOfSCIMSourceUser(value: object): value is SCIMSourceUser {
    if (!("externalId" in value) || value["externalId"] === undefined) return false;
    if (!("user" in value) || value["user"] === undefined) return false;
    if (!("userObj" in value) || value["userObj"] === undefined) return false;
    if (!("source" in value) || value["source"] === undefined) return false;
    return true;
}

export function SCIMSourceUserFromJSON(json: any): SCIMSourceUser {
    return SCIMSourceUserFromJSONTyped(json, false);
}

export function SCIMSourceUserFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): SCIMSourceUser {
    if (json == null) {
        return json;
    }
    return {
        id: json["id"] == null ? undefined : json["id"],
        externalId: json["external_id"],
        user: json["user"],
        userObj: PartialUserFromJSON(json["user_obj"]),
        source: json["source"],
        attributes: json["attributes"] == null ? undefined : json["attributes"],
    };
}

export function SCIMSourceUserToJSON(json: any): SCIMSourceUser {
    return SCIMSourceUserToJSONTyped(json, false);
}

export function SCIMSourceUserToJSONTyped(
    value?: Omit<SCIMSourceUser, "user_obj"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        id: value["id"],
        external_id: value["externalId"],
        user: value["user"],
        source: value["source"],
        attributes: value["attributes"],
    };
}
