import { DataAccessError } from '@isa/common/data-access';

/**
 * Error thrown when a return process has not completed all required steps.
 * This typically occurs when trying to finalize a return process that still has
 * pending questions or missing information.
 *
 * @extends {DataAccessError<'RETURN_PROCESS_IS_NOT_COMPLETE'>}
 *
 * @param processId - The ID of the process containing the incomplete return
 * @param returnProcessId - The ID of the specific return process that is incomplete
 *
 * @example
 * ```typescript
 * // When attempting to complete a return process that isn't finished
 * if (!isProcessComplete(returnProcess)) {
 *   throw new ReturnProcessIsNotCompleteError(processId, returnProcessId);
 * }
 * ```
 */
export class ReturnProcessIsNotCompleteError extends DataAccessError<'RETURN_PROCESS_IS_NOT_COMPLETE'> {
  constructor(
    public readonly processId: number,
    public readonly returnProcessId: number,
  ) {
    super(
      'RETURN_PROCESS_IS_NOT_COMPLETE',
      `Return process with ID "${returnProcessId}" is not complete for process ID "${processId}".`,
    );
  }
}
