import type * as shxInterfaces from '@smarthome.exchange/interfaces';
import { SimpleLocalMapper, type IIntegrationEntity, type ISimpleLocalSnapshot, type ISimpleLocalSnapshotOptions, type TSimpleLocalRawData } from '../../core/index.js';
import type { ILibreHardwareMonitorConfig } from './libre_hardware_monitor.types.js';
import { libreHardwareMonitorProfile } from './libre_hardware_monitor.types.js';

export class LibreHardwareMonitorMapper {
  public static toSnapshot(optionsArg: Omit<ISimpleLocalSnapshotOptions<ILibreHardwareMonitorConfig>, 'profile'>): ISimpleLocalSnapshot {
    return SimpleLocalMapper.toSnapshot({ ...optionsArg, profile: libreHardwareMonitorProfile });
  }

  public static toSnapshotFromRaw(configArg: ILibreHardwareMonitorConfig, rawDataArg: TSimpleLocalRawData): ISimpleLocalSnapshot {
    return SimpleLocalMapper.toSnapshot({ profile: libreHardwareMonitorProfile, config: configArg, rawData: rawDataArg, online: true, source: 'manual' });
  }

  public static toDevices(snapshotArg: ISimpleLocalSnapshot): shxInterfaces.data.IDeviceDefinition[] {
    return SimpleLocalMapper.toDevices(libreHardwareMonitorProfile, snapshotArg);
  }

  public static toEntities(snapshotArg: ISimpleLocalSnapshot): IIntegrationEntity[] {
    return SimpleLocalMapper.toEntities(libreHardwareMonitorProfile, snapshotArg);
  }

  public static slug(valueArg: unknown): string {
    return SimpleLocalMapper.slug(valueArg);
  }
}
