export type DataSourceType = '气象数据' | '卫星遥感' | '土壤数据' | '作物生长' | '其他';
export type DataSourceStatus = '正常' | '异常' | '离线' | '待配置';
export type AccessMethod = '手动上传' | 'API对接' | 'FTP传输' | 'WebSocket';

export interface ExternalDataSource {
  id: string;
  name: string;
  type: DataSourceType;
  provider: string;
  accessMethod: AccessMethod;
  apiEndpoint?: string;
  updateFrequency: string;
  lastUpdateTime: string;
  dataPoints: number;
  status: DataSourceStatus;
  dataFields: string[];
  description: string;
}

export interface DataSourceForm {
  name: string;
  type: DataSourceType;
  provider: string;
  accessMethod: AccessMethod;
  apiEndpoint?: string;
  updateFrequency: string;
  description: string;
}

export const dataSourceTypes: Array<{ key: DataSourceType; name: string; color: string }> = [
  { key: '气象数据', name: '气象数据', color: '#3b82f6' },
  { key: '卫星遥感', name: '卫星遥感', color: '#10b981' },
  { key: '土壤数据', name: '土壤数据', color: '#8b5cf6' },
  { key: '作物生长', name: '作物生长', color: '#f59e0b' },
  { key: '其他', name: '其他', color: '#6b7280' },
];

export const dataSourceStatuses: Array<{ key: DataSourceStatus; name: string; color: string }> = [
  { key: '正常', name: '正常', color: '#10b981' },
  { key: '异常', name: '异常', color: '#ef4444' },
  { key: '离线', name: '离线', color: '#6b7280' },
  { key: '待配置', name: '待配置', color: '#f59e0b' },
];

export const accessMethods: AccessMethod[] = ['手动上传', 'API对接', 'FTP传输', 'WebSocket'];

export const sampleDataSources: ExternalDataSource[] = [
  {
    id: 'ext-1',
    name: '国家气象局API',
    type: '气象数据',
    provider: '中国气象局',
    accessMethod: 'API对接',
    apiEndpoint: 'https://api.weather.gov.cn/v1/data',
    updateFrequency: '每小时',
    lastUpdateTime: '2024-10-15 14:00:00',
    dataPoints: 24850,
    status: '正常',
    dataFields: ['温度', '湿度', '气压', '降水量', '风速', '风向'],
    description: '实时气象数据，包含温度、湿度、降水等多维度信息',
  },
  {
    id: 'ext-2',
    name: 'Sentinel-2卫星数据',
    type: '卫星遥感',
    provider: 'ESA欧空局',
    accessMethod: 'API对接',
    apiEndpoint: 'https://scihub.copernicus.eu/dhus',
    updateFrequency: '每5天',
    lastUpdateTime: '2024-10-12 08:30:00',
    dataPoints: 1280,
    status: '正常',
    dataFields: ['NDVI', 'EVI', 'LAI', '地表温度', '土壤湿度指数'],
    description: '高分辨率卫星遥感影像，用于作物长势监测',
  },
  {
    id: 'ext-3',
    name: '土壤数据库',
    type: '土壤数据',
    provider: '农业部土壤监测中心',
    accessMethod: '手动上传',
    updateFrequency: '每季度',
    lastUpdateTime: '2024-09-20 10:15:00',
    dataPoints: 385,
    status: '正常',
    dataFields: ['pH值', '有机质', '氮磷钾含量', '土壤质地', '盐分'],
    description: '区域土壤理化性质数据',
  },
  {
    id: 'ext-4',
    name: '光照辐射数据',
    type: '气象数据',
    provider: '光伏气象站网络',
    accessMethod: 'FTP传输',
    updateFrequency: '每30分钟',
    lastUpdateTime: '2024-10-15 13:30:00',
    dataPoints: 15620,
    status: '正常',
    dataFields: ['总辐射', '直接辐射', '散射辐射', '光合有效辐射'],
    description: '太阳辐射数据，用于光合作用分析',
  },
  {
    id: 'ext-5',
    name: '作物生长监测系统',
    type: '作物生长',
    provider: '农业大学作物研究所',
    accessMethod: 'WebSocket',
    updateFrequency: '实时',
    lastUpdateTime: '2024-10-15 14:05:00',
    dataPoints: 8920,
    status: '异常',
    dataFields: ['株高', '叶面积指数', '生物量', '产量预测', '病虫害指数'],
    description: '作物生长实时监测数据，提供生长预测分析',
  },
];