export type DecisionLevel = 'critical' | 'important' | 'normal' | 'suggestion';

export type DecisionSource = 'auto' | 'manual';

export type ExecutionMode = 'manual' | 'auto';

export type DecisionAction = 'open' | 'close';

export interface TriggerCondition {
  device: string;
  parameter: string;
  operator: string;
  value: string;
}

export interface ExecutionSetting {
  device: string;
  action: DecisionAction;
  duration: number;
}

export interface FusionProcessStep {
  step: string;
  result: string;
  weight: number;
}

export interface DecisionInputItem {
  id: string;
  name: string;
}

export interface DecisionInputData {
  models: DecisionInputItem[];
  rules: DecisionInputItem[];
  context: DecisionInputItem[];
}

export interface DecisionResult {
  id: string;
  name: string;
  source: DecisionSource;
  executionMode: ExecutionMode;
  triggerCondition: TriggerCondition;
  execution: ExecutionSetting;
  level: DecisionLevel;
  confidence: number;
  recommendation: string;
  explanation: string;
  actionItems: string[];
  inputData: DecisionInputData;
  fusionProcess: FusionProcessStep[];
  generatedAt: string;
  createdBy?: string;
}

export interface DecisionFormState {
  name: string;
  level: DecisionLevel;
  confidence: number;
  executionMode: ExecutionMode;
  triggerDevice: string;
  triggerParameter: string;
  triggerOperator: string;
  triggerValue: string;
  targetDevice: string;
  targetAction: DecisionAction;
  duration: number;
  recommendation: string;
  explanation: string;
  actionItems: string;
}

export type ExecuteResultStatus = 'success' | 'warning' | 'error' | 'info';

export interface ExecuteResultDetail {
  step: string;
  status: ExecuteResultStatus;
  message: string;
}

export interface ExecuteResult {
  success: boolean;
  executedAt: string;
  details: ExecuteResultDetail[];
}
