import type { EmsCrudForm, EmsCrudQuery, EmsId, IntegrationEndpointVO as IntegrationEndpointEntity } from '@/api/ems/types';
import type { ControlCommandLogVO, IntegrationPointMapVO } from '@/api/ems/types';

export type IntegrationEndpointId = EmsId;
export type IntegrationEndpointIds = IntegrationEndpointId[];

export interface IntegrationEndpointVO extends IntegrationEndpointEntity {}

export interface IntegrationEndpointForm extends EmsCrudForm<IntegrationEndpointVO> {}

export interface IntegrationEndpointQuery extends EmsCrudQuery<IntegrationEndpointVO> {}

export interface IntegrationConnectionTestForm {
  endpointId?: EmsId;
  endpointName?: string;
  endpointType?: string;
  accessMode?: string;
  host?: string;
  port?: number;
  configJson?: string;
  status?: string;
}

export interface IntegrationConnectionTestResult {
  success?: boolean;
  endpointName?: string;
  title?: string;
  message?: string;
  checkedItems?: string[];
}

export interface IntegrationPayloadPreviewForm {
  endpointId?: EmsId;
  mapId?: EmsId;
  monitorCode?: string;
  metricCode?: string;
  commandType?: string;
  commandValue?: string;
  dataFormat?: string;
}

export interface IntegrationPayloadPreviewResult {
  endpointName?: string;
  monitorName?: string;
  dataFormat?: string;
  payloadText?: string;
  jsonPayloadText?: string;
  xmlPayloadText?: string;
}

export interface IntegrationCommandDispatchForm extends IntegrationPayloadPreviewForm {}

export interface IntegrationWorkbenchDetail {
  endpoint?: IntegrationEndpointVO;
  pointMaps?: IntegrationPointMapVO[];
  commandLogs?: ControlCommandLogVO[];
}
