import type {
  NdmAlarmHostResultVO,
  NdmCameraResultVO,
  NdmDecoderResultVO,
  NdmKeyboardResultVO,
  NdmMediaServerResultVO,
  NdmNvrResultVO,
  NdmSecurityBoxResultVO,
  NdmSwitchResultVO,
  NdmVideoServerResultVO,
  Station,
} from '@/apis';
import { DEVICE_TYPE_LITERALS, type DeviceType } from '@/enums';

export interface DeviceStoreIndex {
  stationCode: Station['code'];
  deviceType: DeviceType;
  deviceDbId: string;
}

export interface StationDevices {
  [DEVICE_TYPE_LITERALS.ndmAlarmHost]: NdmAlarmHostResultVO[];
  [DEVICE_TYPE_LITERALS.ndmCamera]: NdmCameraResultVO[];
  [DEVICE_TYPE_LITERALS.ndmDecoder]: NdmDecoderResultVO[];
  [DEVICE_TYPE_LITERALS.ndmKeyboard]: NdmKeyboardResultVO[];
  [DEVICE_TYPE_LITERALS.ndmMediaServer]: NdmMediaServerResultVO[];
  [DEVICE_TYPE_LITERALS.ndmNvr]: NdmNvrResultVO[];
  [DEVICE_TYPE_LITERALS.ndmSecurityBox]: NdmSecurityBoxResultVO[];
  [DEVICE_TYPE_LITERALS.ndmSwitch]: NdmSwitchResultVO[];
  [DEVICE_TYPE_LITERALS.ndmVideoServer]: NdmVideoServerResultVO[];
}

export interface LineDevices {
  [stationCode: Station['code']]: StationDevices;
}

export const initStationDevices = (): StationDevices => {
  return {
    [DEVICE_TYPE_LITERALS.ndmAlarmHost]: [],
    [DEVICE_TYPE_LITERALS.ndmCamera]: [],
    [DEVICE_TYPE_LITERALS.ndmDecoder]: [],
    [DEVICE_TYPE_LITERALS.ndmKeyboard]: [],
    [DEVICE_TYPE_LITERALS.ndmMediaServer]: [],
    [DEVICE_TYPE_LITERALS.ndmNvr]: [],
    [DEVICE_TYPE_LITERALS.ndmSecurityBox]: [],
    [DEVICE_TYPE_LITERALS.ndmSwitch]: [],
    [DEVICE_TYPE_LITERALS.ndmVideoServer]: [],
  };
};
