/* 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 { LoginChallengeTypes } from "./LoginChallengeTypes";
import { LoginChallengeTypesFromJSON, LoginChallengeTypesToJSON } from "./LoginChallengeTypes";

/**
 * Serializer for Login buttons of sources
 * @export
 * @interface LoginSource
 */
export interface LoginSource {
    /**
     *
     * @type {string}
     * @memberof LoginSource
     */
    name: string;
    /**
     *
     * @type {string}
     * @memberof LoginSource
     */
    iconUrl?: string | null;
    /**
     *
     * @type {boolean}
     * @memberof LoginSource
     */
    promoted?: boolean;
    /**
     *
     * @type {LoginChallengeTypes}
     * @memberof LoginSource
     */
    challenge: LoginChallengeTypes;
}

/**
 * Check if a given object implements the LoginSource interface.
 */
export function instanceOfLoginSource(value: object): value is LoginSource {
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("challenge" in value) || value["challenge"] === undefined) return false;
    return true;
}

export function LoginSourceFromJSON(json: any): LoginSource {
    return LoginSourceFromJSONTyped(json, false);
}

export function LoginSourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginSource {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        iconUrl: json["icon_url"] == null ? undefined : json["icon_url"],
        promoted: json["promoted"] == null ? undefined : json["promoted"],
        challenge: LoginChallengeTypesFromJSON(json["challenge"]),
    };
}

export function LoginSourceToJSON(json: any): LoginSource {
    return LoginSourceToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        icon_url: value["iconUrl"],
        promoted: value["promoted"],
        challenge: LoginChallengeTypesToJSON(value["challenge"]),
    };
}
