import { Token } from '../../../../domain/entities/token';
import { TokenEntity } from '../../entities/token.entity';

export const tokenMapper = {
  toDomain(entity: TokenEntity): Token {
    return new Token(
      entity.id,
      entity.isNative,
      entity.address,
      entity.networkId,
      entity.thumbnail,
      entity.name,
      entity.symbol,
      entity.decimals,
      entity.code,
      entity.info,
      entity.isActive,
      entity.minimumSwapValue,
      entity.mcap,
      entity.createdAt,
      entity.updatedAt,
    );
  },

  toEntity(domain: Token): TokenEntity {
    const entity = new TokenEntity();
    entity.id = domain.id;
    entity.isNative = domain.isNative;
    entity.address = domain.address;
    entity.networkId = domain.networkId;
    entity.thumbnail = domain.thumbnail;
    entity.name = domain.name;
    entity.symbol = domain.symbol;
    entity.decimals = domain.decimals;
    entity.code = domain.code;
    entity.info = domain.info;
    entity.isActive = domain.isActive;
    entity.minimumSwapValue = domain.minimumSwapValue;
    entity.mcap = domain.mcap;
    entity.createdAt = domain.createdAt;
    entity.updatedAt = domain.updatedAt;
    return entity;
  },
};
