export interface BasicPageParams {
  page: number;
  pageSize: number;
}

export interface BasicFetchResult<T> {
  items: T[];
  total: number;
}

export interface StatusParams {
  id: number;
  status: number;
}

export interface TransferOptionResult {
  key: string;
  title: string;
}

export interface BasicOptionResult {
  label: string;
  value: number | string;
}

export interface BasicTreeOptionResult extends BasicOptionResult {
  children: BasicTreeOptionResult[];
  parentId: number | string;
}

export interface RelationRequest {
  id: number;
  relationIds: number[];
}

export const statusOptions: BasicOptionResult[] = [
  { label: '启用', value: 1 },
  { label: '停用', value: 2 },
];

export const formatterStatus = ({
  cellValue,
}: {
  cellValue: number | string;
}) => {
  const item = statusOptions.find((item) => item.value === cellValue);
  if (item) return item.label;
  return '';
};

export const dbTypeOptions: BasicOptionResult[] = [
  { label: 'MySql', value: 0 },
  { label: 'SqlServer', value: 1 },
  { label: 'Sqlite', value: 2 },
  { label: 'Oracle', value: 3 },
  { label: 'PostgreSQL', value: 4 },
  { label: 'Dm', value: 5 },
  { label: 'Kdbndp', value: 6 },
  { label: 'Oscar', value: 7 },
  { label: 'MySqlConnector', value: 8 },
  { label: 'Access', value: 9 },
  { label: 'OpenGauss', value: 10 },
  { label: 'QuestDB', value: 11 },
  { label: 'HG', value: 12 },
  { label: 'ClickHouse', value: 13 },
  { label: 'GBase', value: 14 },
  { label: 'Custom', value: 15 },
];

export const connectTypeOptions: BasicOptionResult[] = [
  { label: '内联接', value: 0 },
  { label: '左联接', value: 1 },
  { label: '右联接', value: 2 },
  { label: '全联接', value: 3 },
];
