import { Wallet } from '../../../../domain/entities/wallet';
import { WalletEntity } from '../../entities/wallet.entity';

export const walletMapper = {
  toDomain(entity: WalletEntity): Wallet {
    return new Wallet(
      entity.id,
      entity.name,
      entity.syncType,
      entity.syncedAt,
      entity.encryptedPhrase,
      entity.deviceIds,
      entity.isAdmin,
      entity.isActive,
      entity.lastAccessedAt,
      entity.version,
      entity.createdAt,
      entity.updatedAt,
    );
  },

  toEntity(domain: Wallet): WalletEntity {
    const entity = new WalletEntity();
    entity.id = domain.id;
    entity.name = domain.name;
    entity.syncType = domain.syncType;
    entity.syncedAt = domain.syncedAt;
    entity.encryptedPhrase = domain.encryptedPhrase;
    entity.deviceIds = domain.deviceIds;
    entity.isAdmin = domain.isAdmin;
    entity.isActive = domain.isActive;
    entity.lastAccessedAt = domain.lastAccessedAt;
    entity.version = domain.version;
    entity.createdAt = domain.createdAt;
    entity.updatedAt = domain.updatedAt;
    return entity;
  },
};
