/* 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 { AlgEnum } from "./AlgEnum";
import { AlgEnumFromJSON, AlgEnumToJSON } from "./AlgEnum";

/**
 * Certificate generation parameters
 * @export
 * @interface CertificateGenerationRequest
 */
export interface CertificateGenerationRequest {
    /**
     *
     * @type {string}
     * @memberof CertificateGenerationRequest
     */
    commonName: string;
    /**
     *
     * @type {string}
     * @memberof CertificateGenerationRequest
     */
    subjectAltName?: string;
    /**
     *
     * @type {number}
     * @memberof CertificateGenerationRequest
     */
    validityDays: number;
    /**
     *
     * @type {AlgEnum}
     * @memberof CertificateGenerationRequest
     */
    alg?: AlgEnum;
}

/**
 * Check if a given object implements the CertificateGenerationRequest interface.
 */
export function instanceOfCertificateGenerationRequest(
    value: object,
): value is CertificateGenerationRequest {
    if (!("commonName" in value) || value["commonName"] === undefined) return false;
    if (!("validityDays" in value) || value["validityDays"] === undefined) return false;
    return true;
}

export function CertificateGenerationRequestFromJSON(json: any): CertificateGenerationRequest {
    return CertificateGenerationRequestFromJSONTyped(json, false);
}

export function CertificateGenerationRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): CertificateGenerationRequest {
    if (json == null) {
        return json;
    }
    return {
        commonName: json["common_name"],
        subjectAltName: json["subject_alt_name"] == null ? undefined : json["subject_alt_name"],
        validityDays: json["validity_days"],
        alg: json["alg"] == null ? undefined : AlgEnumFromJSON(json["alg"]),
    };
}

export function CertificateGenerationRequestToJSON(json: any): CertificateGenerationRequest {
    return CertificateGenerationRequestToJSONTyped(json, false);
}

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

    return {
        common_name: value["commonName"],
        subject_alt_name: value["subjectAltName"],
        validity_days: value["validityDays"],
        alg: AlgEnumToJSON(value["alg"]),
    };
}
