import { B2B_Error, Reply, ReplyStatus } from "../Common/types.js";

//#region src/utils/NMB2BError.d.ts

/**
 * Represents an error response received from NM B2B
 */
declare class NMB2BError extends Error {
  /**
   * UTC time at which the request was received at NM.
   *
   * Always set when an XML reply is returned, regardless of the possible exceptions that occurred within the request processing.
   */
  requestReceptionTime?: Date;
  /**
   * Identification of the request. This id is not unique across time: the request is uniquely identified via two attributes: `requestReceptionTime` and `requestId`.
   *
   * Always set when an XML reply is returned, regardless of the possible exceptions that occurred within the request processing.
   */
  requestId?: string;
  /**
   * UTC time at which NM has sent the reply.
   *
   * Always set when an XML reply is returned, regardless of the possible exceptions that occurred within the request processing.
   */
  sendTime?: Date;
  /**
   * Status code explaining the error.
   */
  status: Exclude<ReplyStatus, 'OK'>;
  /**
   * Contains the input validation errors, if any.
   * Set to null if the request successfully passed input validations (i.e. status is not set to `INVALID_INPUT`).
   */
  inputValidationErrors?: Array<B2B_Error>;
  /**
   * Contains the output validation errors, if any.
   * Set to null if the request successfully passed output validations (i.e. status is not set to `INVALID_OUTPUT`).
   */
  outputValidationErrors?: Array<B2B_Error>;
  /**
   * Warnings, if any
   */
  warnings?: Array<B2B_Error>;
  /**
   * Describes an error caused by a SLA violation.
   *
   */
  slaError?: B2B_Error;
  reason?: string;
  constructor({
    reply
  }: {
    reply: Reply & {
      status: Exclude<ReplyStatus, 'OK'>;
    };
  });
}
//#endregion
export { NMB2BError };
//# sourceMappingURL=NMB2BError.d.ts.map