import { request } from "../../app/api.js";

export const listAccounts = () => request("/accounts");
export const startAccountLoginAttempt = () => request("/account-login-attempts", { method: "POST", body: {} });
export const completeAccountLoginAttempt = (attemptId) => request(`/account-login-attempts/${encodeURIComponent(attemptId)}/complete`, { method: "POST" });
export const cancelAccountLoginAttempt = (attemptId) => request(`/account-login-attempts/${encodeURIComponent(attemptId)}`, { method: "DELETE" });
export const connectAccount = (accountId) => request(`/accounts/${encodeURIComponent(accountId)}/login`, { method: "POST" });
export const completeAccountLogin = (accountId) => request(`/accounts/${encodeURIComponent(accountId)}/login/complete`, { method: "POST" });
export const updateAccount = (accountId, label) => request(`/accounts/${encodeURIComponent(accountId)}`, { method: "PATCH", body: { label } });
export const deleteAccount = (accountId) => request(`/accounts/${encodeURIComponent(accountId)}`, { method: "DELETE" });
