// ISO 20022 Message Transformation

import { iso20022Service } from './iso20022.service';
import { DbisExtension } from '@/shared/types';

export class Iso20022TransformationService {
  /**
   * Add DBIS extensions to message
   */
  addDbisExtensions(message: any, extensions: DbisExtension): any {
    return {
      ...message,
      dbisExtensions: extensions,
    };
  }

  /**
   * Validate ISO 20022 message
   */
  async validateMessage(rawMessage: string): Promise<boolean> {
    try {
      await iso20022Service.parseMessage(rawMessage);
      return true;
    } catch (error) {
      return false;
    }
  }
}

export const iso20022TransformationService = new Iso20022TransformationService();

