import { ProjectPageInput, ProjectPageResponse, ProjectOutput, ProjectAddInput, ProjectUpdateInput } from '/@/api/types/projectType'
import { RequestParams } from './http-client'
import { ContentType, HttpClient } from './http-client'

export class ProjectApi extends HttpClient {
  /**
   * 获取分页列表
   */
  getPage = (data: ProjectPageInput, params: RequestParams = {}) =>
    this.request<ProjectPageResponse>({
      path: `/api/admin/project/get-page`,
      method: 'POST',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 获取单条数据
   */
  get = (params: { id: number }, requestParams: RequestParams = {}) =>
    this.request<ProjectOutput>({
      path: `/api/admin/project/get`,
      method: 'GET',
      query: params,
      ...requestParams,
    })

  /**
   * 新增
   */
  add = (data: ProjectAddInput, params: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/project/add`,
      method: 'POST',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 更新
   */
  update = (data: ProjectUpdateInput, params: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/project/update`,
      method: 'PUT',
      body: data,
      type: ContentType.Json,
      ...params,
    })

  /**
   * 软删除
   */
  softDelete = (params: { id: number }, requestParams: RequestParams = {}) =>
    this.request<any>({
      path: `/api/admin/project/soft-delete`,
      method: 'DELETE',
      query: params,
      ...requestParams,
    })
} 