/**
 * 会员管理API
 * @author pangu
 */
import request from '@/utils/request'

/**
 * 查询会员列表
 */
export function listMember(query) {
  return request({
    url: '/member/list',
    method: 'get',
    params: query
  })
}

/**
 * 获取会员详情
 */
export function getMember(id) {
  return request({
    url: `/member/${id}`,
    method: 'get'
  })
}

/**
 * 新增会员
 */
export function addMember(data) {
  return request({
    url: '/member',
    method: 'post',
    data
  })
}

/**
 * 修改会员
 */
export function updateMember(data) {
  return request({
    url: '/member',
    method: 'put',
    data
  })
}

/**
 * 删除会员
 */
export function deleteMember(id) {
  return request({
    url: `/member/${id}`,
    method: 'delete'
  })
}

/**
 * 重置会员密码
 */
export function resetMemberPwd(id) {
  return request({
    url: `/member/resetPwd/${id}`,
    method: 'put'
  })
}

/**
 * 获取区域树
 */
export function getRegionTree() {
  return request({
    url: '/region/tree',
    method: 'get'
  })
}

/**
 * 获取学校列表
 */
export function getSchoolList(regionId) {
  return request({
    url: '/school/list',
    method: 'get',
    params: { regionId }
  })
}

/**
 * 获取年级列表
 */
export function getGradeList(schoolId) {
  return request({
    url: '/grade/list',
    method: 'get',
    params: { schoolId }
  })
}

/**
 * 获取班级列表
 */
export function getClassList(gradeId) {
  return request({
    url: '/class/list',
    method: 'get',
    params: { gradeId }
  })
}
