/* 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.
 */

/**
 * License Serializer
 * @export
 * @interface License
 */
export interface License {
    /**
     *
     * @type {string}
     * @memberof License
     */
    readonly licenseUuid: string;
    /**
     *
     * @type {string}
     * @memberof License
     */
    readonly name: string;
    /**
     *
     * @type {string}
     * @memberof License
     */
    key: string;
    /**
     *
     * @type {Date}
     * @memberof License
     */
    readonly expiry: Date;
    /**
     *
     * @type {number}
     * @memberof License
     */
    readonly internalUsers: number;
    /**
     *
     * @type {number}
     * @memberof License
     */
    readonly externalUsers: number;
}

/**
 * Check if a given object implements the License interface.
 */
export function instanceOfLicense(value: object): value is License {
    if (!("licenseUuid" in value) || value["licenseUuid"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("key" in value) || value["key"] === undefined) return false;
    if (!("expiry" in value) || value["expiry"] === undefined) return false;
    if (!("internalUsers" in value) || value["internalUsers"] === undefined) return false;
    if (!("externalUsers" in value) || value["externalUsers"] === undefined) return false;
    return true;
}

export function LicenseFromJSON(json: any): License {
    return LicenseFromJSONTyped(json, false);
}

export function LicenseFromJSONTyped(json: any, ignoreDiscriminator: boolean): License {
    if (json == null) {
        return json;
    }
    return {
        licenseUuid: json["license_uuid"],
        name: json["name"],
        key: json["key"],
        expiry: new Date(json["expiry"]),
        internalUsers: json["internal_users"],
        externalUsers: json["external_users"],
    };
}

export function LicenseToJSON(json: any): License {
    return LicenseToJSONTyped(json, false);
}

export function LicenseToJSONTyped(
    value?: Omit<
        License,
        "license_uuid" | "name" | "expiry" | "internal_users" | "external_users"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        key: value["key"],
    };
}
