import request from '@/utils/request'

export function listJobTemplate(query) {
  return request({
    url: '/monitor/tenantJob/template/list',
    method: 'get',
    params: query
  })
}

export function listTenantScopeTemplates() {
  return request({
    url: '/monitor/tenantJob/template/tenantScope',
    method: 'get'
  })
}

export function getTenantJobConfig(tenantId) {
  return request({
    url: '/monitor/tenantJob/config/' + tenantId,
    method: 'get'
  })
}

export function saveTenantJobConfig(data) {
  return request({
    url: '/monitor/tenantJob/config',
    method: 'put',
    data: data
  })
}

export function syncTenantJob(tenantId) {
  return request({
    url: '/monitor/tenantJob/sync/' + tenantId,
    method: 'post'
  })
}

export function syncAllTenantJob() {
  return request({
    url: '/monitor/tenantJob/syncAll',
    method: 'post'
  })
}

export function updateTenantJobStatus(configId, status) {
  return request({
    url: '/monitor/tenantJob/config/status',
    method: 'put',
    params: { configId, status }
  })
}
