import service from '@/utils/apiService'
const baseUrl = '/api/projects'

export function getProject(id) {
  return service({
    url: `${baseUrl}/${id}`,
    method: 'get'
  })
}

export function getProjects(params) {
  return service({
    url: `${baseUrl}`,
    method: 'get',
    params
  })
}

export function createProject(data) {
  return service({
    url: `${baseUrl}`,
    method: 'post',
    data
  })
}

export function updateProject(id, data) {
  return service({
    url: `${baseUrl}/${id}`,
    method: 'put',
    data
  })
}

export function deleteProject(id) {
  return service({
    url: `${baseUrl}/${id}`,
    method: 'delete'
  })
}

export function lookupAll() {
  return service({
    url: `${baseUrl}/lookup/all`,
    method: 'get'
  })
}

export function getSetting(projectId) {
  return service({
    url: `${baseUrl}/${projectId}/setting`,
    method: 'get'
  })
}

export function saveSetting(projectId, data) {
  return service({
    url: `${baseUrl}/${projectId}/setting`,
    method: 'post',
    data
  })
}
