
import BaseService from '../base'
import { AcceptJoinDTO, CreateEnterpriseDTO, DeleteEnterpriseDTO, updateEnterpriseDTO, UpdateLeaderDTO } from './service.dto'

export default class Enterprise extends BaseService {
  router= {
    accept: { path: '/v1/enterprise/accept-join', crediential: true },
    create: { path: '/v1/enterprise/create', crediential: true },
    delete: { path: '/v1/enterprise/delete', crediential: true },
    info: { path: '/v1/enterprise/info', crediential: true },
    update: { path: '/v1/enterprise/update', crediential: true },
    leader: { path: '/v1/enterprise/update-leader', crediential: true }
  }
  //  constructor() {
  //    super()
  //  }
  /**
   * 员工接受团队邀请
   * @param {AcceptJoinDTO} data {AcceptJoinDTO}
   * @returns
   */
  async acceptJoin(data:AcceptJoinDTO) {
    return await this.useService(this.router.accept, data)
  }

  /**
 * 创建企业
 * @param {CreateEnterpriseDTO} data {CreateEnterpriseDTO}
 * @returns
 */
  async create(data:CreateEnterpriseDTO) {
    return await this.useService(this.router.create, data)
  }

  /**
 * 解散企业
 * @param {DeleteEnterpriseDTO} data {DeleteEnterpriseDTO}
 * @returns
 */
  async deleteEnterprise(data:DeleteEnterpriseDTO) {
    return await this.useService(this.router.delete, data)
  }

  /**
 * 获取企业信息
 * @param {DeleteEnterpriseDTO} data {DeleteEnterpriseDTO}
 * @returns
 */
  async getEnterpriseInfo(data:DeleteEnterpriseDTO) {
    return await this.useService(this.router.info, data)
  }

  /**
 * 更新企业信息
 * @param {updateEnterpriseDTO} data {updateEnterpriseDTO}
 * @returns
 */
  async updateEnterprise(data:updateEnterpriseDTO) {
    return await this.useService(this.router.update, data)
  }

  /**
 * 更新企业负责人
 * @param {UpdateLeaderDTO} data {UpdateLeaderDTO}
 * @returns
 */
  async updateLeader(data:UpdateLeaderDTO) {
    return await this.useService(this.router.leader, data)
  }
}

