import request from '@/utils/request'
import { sellerShopHeaders } from '@/utils/sellerShop'

// 查询当前店铺员工列表
export function listSellerEmployee(query) {
  return request({
    url: '/agri/seller/employee/list',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 查询员工配额（商户级已用/全局上限）
export function sellerEmployeeQuota() {
  return request({
    url: '/agri/seller/employee/quota',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 当前店铺可选角色
export function sellerEmployeeRoleOptions() {
  return request({
    url: '/agri/seller/employee/roleOptions',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 查询员工详情
export function getSellerEmployee(userId) {
  return request({
    url: '/agri/seller/employee/' + userId,
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 创建员工（不含密码）
export function addSellerEmployee(data) {
  return request({
    url: '/agri/seller/employee',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 编辑员工（含头像、状态、角色）
export function updateSellerEmployee(data) {
  return request({
    url: '/agri/seller/employee',
    method: 'put',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 修改账号（名称/手机/邮箱）
export function updateSellerEmployeeProfile(data) {
  return request({
    url: '/agri/seller/employee/profile',
    method: 'put',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 修改登录密码
export function resetSellerEmployeePassword(data) {
  return request({
    url: '/agri/seller/employee/resetPwd',
    method: 'put',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 删除员工
export function delSellerEmployee(userIds) {
  return request({
    url: '/agri/seller/employee/' + userIds,
    method: 'delete',
    headers: sellerShopHeaders()
  })
}
