import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/cyzh-community/residential/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/cyzh-community/residential/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/cyzh-community/residential/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/cyzh-community/residential/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/cyzh-community/residential/submit',
    method: 'post',
    data: row
  })
}

/**
 * 同步
 * @param residentialOldId
 */
export const syncBuilding = (residentialOldId) => {
  return request({
    url: '/api/cyzh-community/sync/syncBuilding/' + residentialOldId,
    method: 'post',
    params: {
    }
  })
}

export const syncUnit = (residentialOldId) => {
  return request({
    url: '/api/cyzh-community/sync/syncUnit/' + residentialOldId,
    method: 'post',
    params: {
    }
  })
}

export const syncFloor = (residentialOldId) => {
  return request({
    url: '/api/cyzh-community/sync/syncFloor/' + residentialOldId,
    method: 'post',
    params: {
    }
  })
}

export const syncRoom = (residentialOldId) => {
  return request({
    url: '/api/cyzh-community/sync/syncRoom/' + residentialOldId,
    method: 'post',
    params: {
    }
  })
}

// export const syncUser = (residentialOldId) => {
//   return request({
//     url: '/api/sync/syncUser/' + residentialOldId,
//     method: 'post',
//     params: {
//     }
//   })
// }

export const updateNumber = (ids) => {
  return request({
    url: '/api/community/residential/updateNumber',
    method: 'get',
    params: {
      ids,
    }
  })
}

export const syncHouseInfoAndUser = (oldIds) => {
  return request({
    url: '/api/sync/syncHouseInfoAndUser',
    method: 'post',
    params: {
      oldIds
    }
  })
}

export const getAllList = (size) => {
  return request({
    url: '/api/cyzh-community/residential/list',
    method: 'get',
    params: {
      size
    }
  })
}
