import { request } from '@/utils/request'
import { TodayEventCase, TodayStatistics } from './model'

export const HomeApi = {
  CAR_TYPE_TOTAL: '/admin/index/carTypeTotal',
  TODAY_DUTY: 'admin/index/todayDuty',
  TODAY_CASE: '/admin/index/todayCase',
  SPECIAL_VEHICLE:'/admin/index/specialVehicle'
}

/**
 * 获取消防车辆统计
 * @returns 
 */
export function getCarTypeTotal() {
  return request<{},ResultData<{
    /**
     * 汽车类型
     */
    carType: string, 
    /**
     * 汽车数量
     */
    total: number
  }[]>>({
    url: HomeApi.CAR_TYPE_TOTAL,
    method: 'get'
  })
}


/**
 *  获取今日值班类型
 * @returns 
 */
export function getTodayDuty() {
  return request<{},ResultData<{
    /**
     * 值班类型
     */
    zblx: string, 
    /**
     * 值班人员
     */
    yhxm: string
  }[]>>({
    url: HomeApi.TODAY_DUTY,
    method: 'get'
  })
}


/**
 * 获取今日警情
 * @returns 
 */
export function getTodayCase() {
  return request<{},ResultData<[
    TodayStatistics,
    TodayEventCase[]
  ]>>({
    url: HomeApi.TODAY_CASE,
    method: 'get'
  })
}

export function getSpecialVehicle() {
  return request<{},ResultData<{
    "xfzblxdm": string, 
    "mc": string, // 名称
    "total": string, // 总数
    "dm": string, // 待命
    "fd": string // 返队
  }[]>>({
    url: HomeApi.SPECIAL_VEHICLE,
    method: 'get'
  })
}
