export const ARCGIS_URL = import.meta.env.VITE_ARCGIS_URL || 'http://10.8.4.136:9090/tba-gis/static/arcgis4_7'

export const ARCGIS_CSS = `${ARCGIS_URL}/esri/css/main.css`
export const ARCGIS_INIT = `${ARCGIS_URL}/init.js?r=1`

export const BASEMAP_URL = 'http://10.8.4.128/server/rest/services/OneMap/TH_XZQH_2000/MapServer'

export const WKID = 4490

export const DEFAULT_EXTENT = {
  xmin: 117.23277038231637,
  ymin: 29.520199484581486,
  xmax: 123.65255617604646,
  ymax: 32.551632806009266,
}

export const DEFAULT_CENTER = [31.2, 120.5]
export const DEFAULT_ZOOM = 8

export const ZONE_CONFIG = [
  { key: 'tph', label: '太浦河', color: '#409EFF' },
  { key: 'wyh', label: '望虞河', color: '#67C23A' },
  { key: 'hh', label: '环湖', color: '#E6A23C' },
  { key: 'yj', label: '沿江', color: '#F56C6C' },
  { key: 'hzw', label: '杭州湾', color: '#9B59B6' },
  { key: 'sk', label: '水库', color: '#1ABC9C' },
]

export const ZONE_COLORS = Object.fromEntries(ZONE_CONFIG.map(z => [z.key, z.color]))
export const ZONE_LABELS = Object.fromEntries(ZONE_CONFIG.map(z => [z.key, z.label]))

export const TYPE_MAP = {
  reservoir: '水库',
  dike: '堤防',
  pust: '水闸',
  waga: '泵站',
}

export const TBA_BASIN_PATHS = [
  [119.865,30.739],[119.988,30.713],[120.083,30.692],[120.181,30.667],[120.271,30.664],[120.334,30.69],
  [120.43,30.723],[120.665,30.739],[120.74,30.747],[120.925,30.727],[121.029,30.732],[121.122,30.775],
  [121.213,30.803],[121.264,30.917],[121.309,30.991],[121.326,31.067],[121.24,31.117],[121.266,31.198],
  [121.28,31.285],[121.418,31.288],[121.477,31.327],[121.452,31.418],[121.409,31.494],[121.341,31.559],
  [121.258,31.599],[121.136,31.642],[121.008,31.645],[120.895,31.644],[120.794,31.624],[120.708,31.635],
  [120.655,31.612],[120.646,31.583],[120.669,31.533],[120.656,31.473],[120.539,31.469],[120.457,31.448],
  [120.402,31.401],[120.408,31.326],[120.401,31.251],[120.257,31.219],[120.201,31.183],[120.195,31.133],
  [120.177,31.061],[120.09,30.998],[120.002,30.932],[119.968,30.87],[119.942,30.83],[119.93,30.79],
  [119.865,30.739]
]

export const WIU_DATA_TYPES = [
  { key: 'TBA_SW_1H2H', label: '水文监测', api: 'realtime', color: '#409EFF', icon: 'hydrology' },
  { key: 'TBA_SZY_SJ_RIVER', label: '省界河流', api: 'waterQuality', color: '#67C23A', icon: 'river' },
  { key: 'TBA_SZY_SJ_BASIN', label: '省界湖泊', api: 'waterQuality', color: '#E6A23C', icon: 'basin' },
  { key: 'TBA_SZY_RH', label: '入湖河道', api: 'waterQuality', color: '#F56C6C', icon: 'inflow' },
  { key: 'TBA_SYD_LZDC', label: '水源地', api: 'waterQuality', color: '#9B59B6', icon: 'source' },
  { key: 'TBA_SZ_1H2H', label: '水质自动站', api: 'waterQuality', color: '#1ABC9C', icon: 'auto' },
  { key: 'TBA_SZY_LZJC', label: '太湖藻类', api: 'waterQuality', color: '#FF6B6B', icon: 'algae' },
]

export const BUSINESS_UNITS = [
  {
    key: 'unit0', label: '太湖流域管理局',
    buttons: [
      { code: 'TBA_SW_1H2H', label: '水文监测', count: 4 },
      { code: 'TBA_SZY_SJ_RIVER', label: '省界河流', count: 34 },
      { code: 'TBA_SZY_SJ_BASIN', label: '省界湖泊', count: 37 },
      { code: 'TBA_SYD_LZDC', label: '水源地', count: 9 },
      { code: 'TBA_SZY_RH', label: '入湖河道', count: 22 },
      { code: 'TBA_SZY_LZJC', label: '太湖藻类', count: 33 },
      { code: 'TBA_SZ_1H2H', label: '水质自动站', count: 6 },
    ]
  },
  {
    key: 'unit1', label: '江苏省水利厅',
    buttons: [
      { code: 'JS_SL_SW', label: '水位监测数据', count: 0 },
      { code: 'JS_SL_RH', label: '入太湖河道', count: 0 },
      { code: 'JS_SL_SYD', label: '重要水源地', count: 0 },
      { code: 'JS_SL_LZDC', label: '蓝藻数据', count: 0 },
      { code: 'JS_SL_ZDZ', label: '水质自动站', count: 0 },
    ]
  },
  {
    key: 'unit2', label: '江苏省生态环境厅',
    buttons: [
      { code: 'JS_ST_WRY', label: '行政区污染物', count: 0 },
      { code: 'JS_ST_PWK', label: '排污口', count: 0 },
      { code: 'JS_ST_NY', label: '农业面源污染量', count: 0 },
      { code: 'JS_ST_SJ', label: '行政交界断面', count: 0 },
      { code: 'JS_ST_SYD', label: '重要水源地', count: 0 },
      { code: 'JS_ST_ZDZ', label: '水质监测自动站', count: 0 },
    ]
  },
  {
    key: 'unit3', label: '浙江省水利厅',
    buttons: [
      { code: 'ZJ_SL_SW', label: '水位监测数据', count: 0 },
      { code: 'ZJ_SL_RH', label: '入太湖河道', count: 0 },
      { code: 'ZJ_SL_ZDZ', label: '水质自动站', count: 0 },
    ]
  },
  {
    key: 'unit4', label: '浙江省生态环境厅',
    buttons: [
      { code: 'ZJ_ST_WRY', label: '行政区污染物', count: 0 },
      { code: 'ZJ_ST_PWK', label: '排污口', count: 0 },
      { code: 'ZJ_ST_NY', label: '农业面源污染量', count: 0 },
      { code: 'ZJ_ST_SJ', label: '行政交界断面', count: 0 },
      { code: 'ZJ_ST_SYD', label: '重要水源地', count: 0 },
      { code: 'ZJ_ST_ZDZ', label: '水质监测自动站', count: 0 },
    ]
  },
  {
    key: 'unit5', label: '上海市生态环境局',
    buttons: [
      { code: 'SH_ST_WRY', label: '行政区污染物', count: 0 },
      { code: 'SH_ST_SJ', label: '行政交界断面', count: 0 },
      { code: 'SH_ST_SYD', label: '重要水源地', count: 0 },
    ]
  },
  {
    key: 'unit6', label: '上海市水务局',
    buttons: [
      { code: 'SH_PWK', label: '排污口', count: 0 },
      { code: 'SH_ZDZ', label: '水质监测自动站', count: 0 },
    ]
  },
]
