import { $t } from '#/locales';

/**
 * 列
 */
const columns = [
  // {
  //   title: $t('robot.account.code'),
  //   dataIndex: 'code',
  //   ellipsis: { showTitle: true },
  // },
  {
    title: $t('robot.account.email'),
    dataIndex: 'email',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.nickname'),
    dataIndex: 'nickname',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.mobile'),
    dataIndex: 'mobile',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.userNumber'),
    dataIndex: 'userNumber',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.notes'),
    dataIndex: 'notes',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.status'),
    dataIndex: 'status',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.valid'),
    dataIndex: 'valid',
    ellipsis: { showTitle: true },
  },
  {
    title: $t('robot.account.lastValidationTime'),
    dataIndex: 'lastValidationTime',
    ellipsis: { showTitle: true },
    sorter: true,
  },
  {
    title: $t('robot.account.groupName'),
    dataIndex: 'groupName',
    ellipsis: { showTitle: true },
  },
  // {
  //   title: $t('robot.account.managerName'),
  //   dataIndex: 'managerName',
  //   ellipsis: { showTitle: true },
  // },
  {
    title: $t('robot.account.createTime'),
    dataIndex: 'createTime',
    ellipsis: { showTitle: true },
    sorter: true,
  },
  {
    title: $t('common.action'),
    dataIndex: 'action',
    fixed: 'right',
    width: 240
  }
]

/**
 * 状态映射
 */
const statusMap = {
  0: $t('robot.account.statusOptions.v0'),
  1: $t('robot.account.statusOptions.v1'),
}

/**
 * 有效状态映射
 */
const validMap = {
  0: $t('robot.account.validOptions.v0'),
  1: $t('robot.account.validOptions.v1'),
}

/**
 * 查询参数
 */
const query = {
  code: '',
  email: '',
  notes: '',
  status: undefined,
  groupName: undefined,
  managerName: '',
  userNumber: '',
  mobile: '',
  nickname: '',
  valid: undefined,
  lastValidationTime: ''
};

export const d = {
  isShowQuery: true,
  loading: false,
  pagination: {
    total: 0,
    current: 1,
    pageSize: 10,
    showTotal: (total, range) => `共 ${total} 条`,
    showSizeChanger: true,
    pageSizeOptions: ['10', '20', '50', '100', '500', '1000'],
    showQuickJumper: true,
  },
  datas: [],
  query,
  columns,
  statusMap,
  validMap,
}