import { DEFAULT_BUTTON_SETTING } from './ts/enum';

export const flowProperties: Record<string, any> = {
  'flow': {
    type: 'flow',
    title: '流程图',
    attrs: ['flowNormal', 'flowMessageAndSignal', 'executionListener', 'expandAttribute', 'other'],
  },
  'start-node': {
    type: 'start-node',
    title: '开始事件',
    iconName: 'CaretRightOutlined',
    attrs: ['normal', 'formComponent', 'executionListener', 'expandAttribute', 'other'],
  },
  'end-node': {
    type: 'end-node',
    title: '结束事件',
    iconName: 'PoweroffOutlined',
    attrs: ['normal', 'executionListener', 'expandAttribute', 'other'],
  },
  'exclusive-gateway-node': {
    type: 'exclusive-gateway-node',
    title: '互斥网关',
    iconName: 'CloseSquareOutlined',
    attrs: ['normal', 'executionListener', 'expandAttribute', 'other'],
  },
  'parallel-gateway-node': {
    type: 'parallel-gateway-node',
    title: '并行网关',
    iconName: 'PicCenterOutlined',
    attrs: ['normal', 'executionListener', 'expandAttribute', 'other'],
  },
  'user-task-node': {
    type: 'user-task-node',
    title: '用户任务',
    iconName: 'UserOutlined',
    approveMethod: 1,
    customConfiguration: {
      approveType: '1', // 审批类型
      rejectHandlerType: '1', // 审批人拒绝时
      rejectReturnTaskId: '', // 驳回节点
      assignEmptyHandlerType: '1', // 审批人为空时
      assignEmptyUserIds: [], // 指定用户
      assignStartUserHandlerType: '1', // 审批人与提交人为同一人时
      // 操作按钮
      buttonsSetting: DEFAULT_BUTTON_SETTING,
      // 字段权限
      fieldsPermission: [
        {
          key: 'leave_date',
          name: '请假区间',
          permission: '1', // 初始选中“只读”
        },
        {
          key: 'leave_resson',
          name: '请假原因',
          permission: '1', // 初始选中“只读”
        },
      ],
      signEnable: false, // 是否需要签名
      reasonRequire: false, // 审批意见
    },
    attrs: ['normal', 'formComponent', 'userTask', 'approveMethod', 'taskListener', 'executionListener', 'expandAttribute', 'other', 'customConfiguration'],
  },
  'normal-task-node': {
    type: 'normal-task-node',
    title: '任务',
    iconName: 'FileOutlined',
    approveMethod: 1,
    customConfiguration: {
      approveType: '1', // 审批类型
      rejectHandlerType: '1', // 审批人拒绝时
      rejectReturnTaskId: '', // 驳回节点
      assignEmptyHandlerType: '1', // 审批人为空时
      assignEmptyUserIds: [], // 指定用户
      assignStartUserHandlerType: '1', // 审批人与提交人为同一人时
      // 操作按钮
      buttonsSetting: DEFAULT_BUTTON_SETTING,
      // 字段权限
      fieldsPermission: [],
      // fieldsPermission: [
      //   {
      //     key: 'leave_date',
      //     name: '请假区间',
      //     permission: '1', // 初始选中“只读”
      //   },
      //   {
      //     key: 'leave_resson',
      //     name: '请假原因',
      //     permission: '1', // 初始选中“只读”
      //   },
      // ],
      signEnable: false, // 是否需要签名
      reasonRequire: false, // 审批意见
    },
    attrs: ['normal', 'approveMethod', 'executionListener', 'expandAttribute', 'other', 'customConfiguration'],
  },
  'custom-bezier-edge': {
    type: 'custom-bezier-edge',
    title: '',
    attrs: ['normal', 'edgeTransfer', 'executionListener', 'expandAttribute', 'other'],
  },
};

export type FlowKeyType = keyof typeof flowProperties;
