/*
 * @Author: xiejiang
 * @Date: 2024-12-03 15:03:13
 * @LastEditors: xiejiang
 * @LastEditTime: 2024-12-04 18:34:57
 * @Description:
 * Copyright（c）2024 by 好老师教育科技有限公司 All right Reserved.
 */
import http from '@/api'
import { ResCompany, ReqCompanyPage, ReqCompany } from '@/api/interface/institution/index'

const api = {
  getCompanyList: '/platform/company/list', // 机构列表
  getCompanyDetail: '/platform/company/detail', // 机构详情
  postCompanyDelete: '/platform/company/delete', // 删除机构
  postCompanySave: '/platform/company/save', // 新增机构
  postCompanyUpdate: '/platform/company/update', // 编辑机构
  // postCompanyStatus: '/platform/company/status', // 变更机构状态
  postCompanyEnable: '/platform/company/enable', // 启用机构
  postCompanyDisable: '/platform/company/disable' // 停用机构
}

/**
 * @description 机构列表
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33162
 * @param page 页码  [必填]
 * @param limit 每页数量（默认为10）
 * @param companyName 机构名称
 * @param companyType 机构类型
 * @param companyStatus 机构状态
 */
export const getCompanyList = (params: ReqCompanyPage) => {
  return http.get<ResCompany[]>(api.getCompanyList, params)
}

/**
 * @description 机构详情
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33161
 * @param companyID companyID  [必填]
 */
export const getDetail = (params: { companyId: string | number }) => {
  return http.get<ResCompany>(api.getCompanyDetail, params)
}

/**
 * @description 删除机构
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33160
 * @param companyId 机构id
 */
export const postCompanyDelete = (data: { companyId: string | number }) => {
  return http.post(api.postCompanyDelete, data)
}

/**
 * @description 新增机构
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33163
 * @param adminUserMobile 机构管理员手机号
 * @param adminUserName 机构管理员姓名
 * @param companyName 机构名称
 * @param companyType 机构类型
 * @param remark 备注
 * @param serviceTerminationTime 服务终止日期
 */
export const postCompanySave = (data: ReqCompany) => {
  return http.post(api.postCompanySave, data)
}

/**
 * @description 编辑机构
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33165
 * @param adminUserMobile 机构管理员手机号
 * @param adminUserName 机构管理员姓名
 * @param companyId 机构id
 * @param companyName 机构名称
 * @param companyType 机构类型
 * @param remark 备注
 * @param serviceTerminationTime 服务终止日期
 */
export const postCompanyUpdate = (data: ReqCompany) => {
  return http.post(api.postCompanyUpdate, data)
}

// /**
//  * @description 变更机构状态
//  * @author 邹琪涛
//  * @docs http://api.seevin.com/project/669/interface/api/33164
//  * @param companyId 机构ID
//  * @param companyStatus 机构状态（1.激活；3.删除；4.冻结）
//  */
// export const postCompanyStatus = (data: ReqCompany) => {
//   return http.post(api.postCompanyStatus, data)
// }

/**
 * @description 启用机构
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33208
 * @param companyId undefined
 */
export const postCompanyEnable = (data: { companyId: number }) => {
  return http.post(api.postCompanyEnable, data)
}
/**
 * @description 停用机构
 * @author 邹琪涛
 * @docs http://api.seevin.com/project/669/interface/api/33208
 * @param companyId undefined
 */
export const postCompanyDisable = (data: { companyId: number }) => {
  return http.post(api.postCompanyDisable, data)
}
