import {AxiosResponse} from "axios";
import {ResponseVO} from "@/lib/definitions";
import {httpReq} from "@/utils/axiosReq";
import {ShareVO, TeamMemberVO} from "@/components/type/Share.d";

export const addTaskPassAPI= (data:ShareVO):Promise<AxiosResponse<ResponseVO<ShareVO>>> =>{
    return httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + "/task/pass",
        data)
}
export const listTeamMemberAPI = (taskId:string):Promise<AxiosResponse<ResponseVO<TeamMemberVO[]>>> =>{
    return httpReq.get(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/team/member/list?taskId=${taskId}`)
}
export const listTaskAdminAPI = (taskId: string):Promise<AxiosResponse<ResponseVO<TeamMemberVO[]>>> => {
    return httpReq.get(process.env.NEXT_PUBLIC_TODO_REQUEST_URL +  `/task/team/admin/list?taskId=${taskId}`)
}

export const removeTeamAPI = (teamMember: TeamMemberVO):Promise<AxiosResponse<ResponseVO<TeamMemberVO[]>>> =>{
    return httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/team/member/remove`,teamMember)
}
export const quitTeamAPI = (teamMember: TeamMemberVO):Promise<AxiosResponse<ResponseVO<TeamMemberVO[]>>> =>{
    return httpReq.delete(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/team/member/quite/${teamMember.id}`)
}
export const allowAddTeamAPI = (teamAllow:any):Promise<AxiosResponse<ResponseVO<TeamMemberVO[]>>> =>{
    return httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + `/task/team/member/allow`,teamAllow)
}