import {deleteData, postData, putData} from "../fetchApi.tsx";
import type IPlayer from "../types/IPlayer.ts";

export function AddPlayer(apiUri: string, steamId: bigint){
    return putData(`${apiUri}/Actions/Player/${steamId}`) as Promise<IPlayer>;
}

export function DeletePlayer(apiUri: string, steamId: bigint){
    return deleteData(`${apiUri}/Actions/Player/${steamId}`) as Promise<void>;
}

export function UpdatePlayerData(apiUri: string, steamId: bigint){
    return postData(`${apiUri}/Actions/Update/Player/${steamId}/All`) as Promise<void>;
}

export function UpdatePlayerInfo(apiUri: string, steamId: bigint){
    return postData(`${apiUri}/Actions/Update/Player/${steamId}/Info`) as Promise<void>;
}

export function UpdatePlayerOwnedGames(apiUri: string, steamId: bigint){
    return postData(`${apiUri}/Actions/Update/Player/${steamId}/OwnedGames`) as Promise<void>;
}

export function UpdatePlayerTimeTracked(apiUri: string, steamId: bigint){
    return postData(`${apiUri}/Actions/Update/Player/${steamId}/TimeTracked`) as Promise<void>;
}

export function UpdateAll(apiUri: string){
    return postData(`${apiUri}/Actions/All`) as Promise<void>;
}