// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0

/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

import { HashAlgorithmEnumType, IdTokenEnumType } from '../enums/index.js';
import type { OcppRequest } from '../../../internal-types.js';

export interface AuthorizeRequest extends OcppRequest {
  idToken: IdTokenType;
  /**
   * *(2.1)* The X.509 certificate chain presented by EV and encoded in PEM format. Order of certificates in chain is from leaf up to (but excluding) root certificate. +
   * Only needed in case of central contract validation when Charging Station cannot validate the contract certificate.
   *
   *
   */
  certificate?: string | null;
  /**
   * @minItems 1
   * @maxItems 4
   */
  iso15118CertificateHashData?:
    | [OCSPRequestDataType]
    | [OCSPRequestDataType, OCSPRequestDataType]
    | [OCSPRequestDataType, OCSPRequestDataType, OCSPRequestDataType]
    | [OCSPRequestDataType, OCSPRequestDataType, OCSPRequestDataType, OCSPRequestDataType]
    | null;
  customData?: CustomDataType | null;
}
/**
 * Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
 *
 */
export interface IdTokenType {
  /**
   * @minItems 1
   */
  additionalInfo?: [AdditionalInfoType, ...AdditionalInfoType[]] | null;
  /**
   * *(2.1)* IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
   *
   */
  idToken: string;
  /**
   * *(2.1)* Enumeration of possible idToken types. Values defined in Appendix as IdTokenEnumStringType.
   *
   */
  type: IdTokenEnumType;
  customData?: CustomDataType | null;
}
/**
 * Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
 *
 */
export interface AdditionalInfoType {
  /**
   * *(2.1)* This field specifies the additional IdToken.
   *
   */
  additionalIdToken: string;
  /**
   * _additionalInfo_ can be used to send extra information to CSMS in addition to the regular authorization with _IdToken_. _AdditionalInfo_ contains one or more custom _types_, which need to be agreed upon by all parties involved. When the _type_ is not supported, the CSMS/Charging Station MAY ignore the _additionalInfo_.
   *
   *
   */
  type: string;
  customData?: CustomDataType | null;
}
/**
 * This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
 */
export interface CustomDataType {
  vendorId: string;
  [k: string]: unknown;
}
/**
 * Information about a certificate for an OCSP check.
 *
 */
export interface OCSPRequestDataType {
  hashAlgorithm: HashAlgorithmEnumType;
  /**
   * The hash of the issuer’s distinguished
   * name (DN), that must be calculated over the DER
   * encoding of the issuer’s name field in the certificate
   * being checked.
   *
   */
  issuerNameHash: string;
  /**
   * The hash of the DER encoded public key:
   * the value (excluding tag and length) of the subject
   * public key field in the issuer’s certificate.
   *
   */
  issuerKeyHash: string;
  /**
   * The string representation of the
   * hexadecimal value of the serial number without the
   * prefix "0x" and without leading zeroes.
   *
   */
  serialNumber: string;
  /**
   * This contains the responder URL (Case insensitive).
   *
   *
   */
  responderURL: string;
  customData?: CustomDataType | null;
}
