/**
 * 订单套餐批量作废任务 API
 */

import { BaseService } from '../BaseService'
import type {
  CreateOrderPackageInvalidateTaskApiResponse,
  CreateOrderPackageInvalidateTaskRequest,
  OrderPackageInvalidateTaskDetailApiResponse,
  OrderPackageInvalidateTaskListApiResponse,
  OrderPackageInvalidateTaskQueryParams
} from '@/types/api'

export class OrderPackageInvalidateTaskService extends BaseService {
  static getTasks(
    params?: OrderPackageInvalidateTaskQueryParams
  ): Promise<OrderPackageInvalidateTaskListApiResponse> {
    return this.get<OrderPackageInvalidateTaskListApiResponse>(
      '/api/admin/order-package-invalidate-tasks',
      params
    )
  }

  static createTask(
    data: CreateOrderPackageInvalidateTaskRequest
  ): Promise<CreateOrderPackageInvalidateTaskApiResponse> {
    return this.post<CreateOrderPackageInvalidateTaskApiResponse>(
      '/api/admin/order-package-invalidate-tasks',
      data
    )
  }

  static getTaskDetail(id: number): Promise<OrderPackageInvalidateTaskDetailApiResponse> {
    return this.getOne(`/api/admin/order-package-invalidate-tasks/${id}`)
  }
}
