import { CIIBaseValidator } from '../cii.validator.js';

/**
 * Validator for ZUGFeRD invoice format
 */
export class ZUGFeRDValidator extends CIIBaseValidator {
  /**
   * Validates ZUGFeRD XML structure
   * @returns True if structure validation passed
   */
  protected validateStructure(): boolean {
    // Check for required elements in ZUGFeRD structure
    const invoiceId = this.getText('//rsm:ExchangedDocument/ram:ID');
    if (!invoiceId) {
      this.addError('ZUGFERD-STRUCT-1', 'Invoice ID is required', '//rsm:ExchangedDocument/ram:ID');
      return false;
    }

    return true;
  }

  /**
   * Validates ZUGFeRD XML against business rules
   * @returns True if business validation passed
   */
  protected validateBusinessRules(): boolean {
    // Implement ZUGFeRD-specific business rules
    // For now, we'll just use the base CII validation
    return true;
  }
}
