import React from 'react';
import { Card, Descriptions, Tag } from 'antd';
import { TaskStatusColor, TaskStatusText } from '@/dicts/supplierTaskDict';
import styles from '../../supplierTaskManageDetail.less';
import { CategoryLimitationType, CategoryLimitationTypeText } from '@/dicts/supplierTemplateDict';

interface BasicInfoProps {
  taskData: SupplierEvaluate.TaskDetailData;
}

const BasicInfo: React.FC<BasicInfoProps> = ({ taskData }) => {
  // 获取状态标签
  const getStatusTag = (status: string) => {
    const color = TaskStatusColor[status as keyof typeof TaskStatusColor] || 'default';
    const text = TaskStatusText[status as keyof typeof TaskStatusText] || '未知状态';
    return <Tag color={color}>{text}</Tag>;
  };

  return (
    <Card className={styles.detailCard}>
      <Descriptions title="基本信息" bordered column={2}>
        <Descriptions.Item label="评价主题">{taskData.evaluateTheme || '--'}</Descriptions.Item>
        <Descriptions.Item label="评价状态">
          {getStatusTag(taskData.status || '')}
        </Descriptions.Item>
        <Descriptions.Item label="评价年份">{taskData.evaluateYear || '--'}</Descriptions.Item>
        <Descriptions.Item label="开始时间">{taskData.startTime || '--'}</Descriptions.Item>
        <Descriptions.Item label="结束时间">{taskData.endTime || '--'}</Descriptions.Item>
        <Descriptions.Item label="评价模板">{taskData.templateName || '--'}</Descriptions.Item>
        <Descriptions.Item label="品类限制">
          {
            CategoryLimitationTypeText[
              taskData.categoryLimitation as keyof typeof CategoryLimitationTypeText
            ]
          }
        </Descriptions.Item>
        {taskData.categoryId && (
          <Descriptions.Item label="品类">{taskData.categoryName}</Descriptions.Item>
        )}
      </Descriptions>
    </Card>
  );
};

export default BasicInfo;
