// Multi-Asset Root Service
// Multi-asset root hashing

import { createHash } from 'crypto';

export class MultiAssetRootService {
  /**
   * Calculate multi-asset root hash
   */
  calculateRoot(assets: {
    cbdc?: Record<string, unknown>[];
    fiat?: Record<string, unknown>[];
    ssu?: Record<string, unknown>[];
    commodity?: Record<string, unknown>[];
    security?: Record<string, unknown>[];
  }): string {
    const dataString = JSON.stringify({
      cbdc: assets.cbdc || [],
      fiat: assets.fiat || [],
      ssu: assets.ssu || [],
      commodity: assets.commodity || [],
      security: assets.security || [],
    });

    return createHash('sha256').update(dataString).digest('hex');
  }
}

export const multiAssetRootService = new MultiAssetRootService();

