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

// 查询当前店铺角色列表
export function listSellerRole(query) {
  return request({
    url: '/agri/seller/role/list',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 查询商家端可分配菜单树
export function sellerRoleMenuTree() {
  return request({
    url: '/agri/seller/role/menuTree',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 查询角色详情
export function getSellerRole(roleId) {
  return request({
    url: '/agri/seller/role/' + roleId,
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 创建角色
export function addSellerRole(data) {
  return request({
    url: '/agri/seller/role',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 修改角色
export function updateSellerRole(data) {
  return request({
    url: '/agri/seller/role',
    method: 'put',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 删除角色（支持批量，逗号分隔）
export function delSellerRole(roleIds) {
  return request({
    url: '/agri/seller/role/' + roleIds,
    method: 'delete',
    headers: sellerShopHeaders()
  })
}
