import { get, post, put } from './request'

export interface SimpleOption {
  value: number
  label: string
}

export interface TeamPayload {
  teamName: string
  memberIds: string
  vehicleIds: string
  teamType: string
  status: string
  remark?: string
}

export function getTeamSimpleList() {
  return get<SimpleOption[]>('/team/simple-list')
}

export function getTeamMembers(teamId: number) {
  return get<Array<{ staffId: number; name: string }>>(`/team/${teamId}/members`)
}

export function createTeam(data: TeamPayload) {
  return post<number>('/team', data)
}

export function updateTeam(teamId: number, data: TeamPayload) {
  return put(`/team`, { ...data, teamId })
}
