import http from '@/utils/http'
import type { PerformanceDimension, PerformanceRule, DimensionQuery, RuleQuery } from './type'

/** 维度相关 */
export function getDimensionList(params?: DimensionQuery) {
  return http.get<PerformanceDimension[]>('/performance-dimension/list', params)
}
export function getDimensionDetail(id: string) {
  return http.get<PerformanceDimension>(`/performance-dimension/${id}`)
}
export function addDimension(data: Partial<PerformanceDimension>) {
  return http.post('/performance-dimension', data)
}
export function updateDimension(id: string, data: Partial<PerformanceDimension>) {
  return http.put(`/performance-dimension/${id}`, data)
}
export function deleteDimension(id: string) {
  return http.del(`/performance-dimension/${id}`)
}

/** 细则相关 */
export function getRuleList(params?: RuleQuery) {
  return http.get<PerformanceRule[]>('/performance-rule/list', params)
}
export function getRuleDetail(id: string) {
  return http.get<PerformanceRule>(`/performance-rule/${id}`)
}
export function addRule(data: Partial<PerformanceRule>) {
  return http.post('/performance-rule', data)
}
export function updateRule(id: string, data: Partial<PerformanceRule>) {
  return http.put(`/performance-rule/${id}`, data)
}
export function deleteRule(id: string) {
  return http.del(`/performance-rule/${id}`)
}
// 我的绩效
export function getMyEvaluation() {
    return http.get('/performance-evaluation/my')
  }