import { Device } from '../../../../domain/entities/device';
import { DeviceEntity } from '../../entities/device.entity';

export const deviceMapper = {
  toDomain(entity: DeviceEntity): Device {
    return new Device(
      entity.id,
      entity.location,
      entity.type,
      entity.info,
      entity.ipAddress,
      entity.userAgent,
      entity.fingerprint,
      entity.status,
      entity.pushToken,
      entity.createdAt,
      entity.updatedAt,
    );
  },

  toEntity(domain: Device): DeviceEntity {
    const entity = new DeviceEntity();
    entity.id = domain.id;
    entity.location = domain.location;
    entity.type = domain.type;
    entity.info = domain.info;
    entity.ipAddress = domain.ipAddress;
    entity.userAgent = domain.userAgent;
    entity.fingerprint = domain.fingerprint;
    entity.status = domain.status;
    entity.pushToken = domain.pushToken;
    entity.createdAt = domain.createdAt;
    entity.updatedAt = domain.updatedAt;
    return entity;
  },
};
