import { BaseQuery } from '@/types/base';
import type { FormSchema } from '@/components/FormDesigner';

/**
 * 业务类型
 */
export type FormDataBusinessType = 'STANDALONE' | 'WORKFLOW' | 'ORDER';

/**
 * 表单数据状态
 */
export type FormDataStatus = 'DRAFT' | 'SUBMITTED' | 'COMPLETED';

/**
 * 表单数据查询参数
 */
export interface FormDataQuery extends BaseQuery {
  formDefinitionId?: number;
  formKey?: string;
  categoryId?: number;  // 分类ID（筛选）
  businessType?: FormDataBusinessType;
  businessKey?: string;
  submitter?: string;
  status?: FormDataStatus;
  submitTimeStart?: string;
  submitTimeEnd?: string;
}

/**
 * 表单数据响应
 */
export interface FormDataResponse {
  id: number;
  formDefinitionId: number;
  formKey: string;
  formVersion: number;
  categoryId?: number;  // 分类ID
  businessKey?: string;
  businessType: FormDataBusinessType;
  data: Record<string, any>;
  schemaSnapshot: FormSchema;
  submitter?: string;
  submitTime?: string;
  status: FormDataStatus;
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
}

/**
 * 表单数据提交请求
 */
export interface FormDataSubmitRequest {
  formDefinitionId: number;
  formKey: string;
  businessType?: FormDataBusinessType;
  businessKey?: string;
  data: Record<string, any>;
  status?: FormDataStatus;
}

/**
 * 表单数据更新请求
 */
export interface FormDataUpdateRequest {
  data: Record<string, any>;
  status?: FormDataStatus;
}

