import api from "src/api";

export const getTreasuryAccountsMe = async () => {
  const { data } = await api.get("/treasury-account/me");
  return data.payload;
};

export const createTreasuryAccountMe = async (payload) => {
  const { data } = await api.post("/treasury-account/me", payload);
  return data.payload;
};

export const updateTreasuryAccountMe = async (id, payload) => {
  const { data } = await api.put(`/treasury-account/me/${id}`, payload);
  return data.payload;
};

export const deleteTreasuryAccountMe = async (id) => {
  const { data } = await api.delete(`/treasury-account/me/${id}`);
  return data;
};

export const getTreasuryLaunchesMe = async (accountId) => {
  const { data } = await api.get("/treasury-launch/me", {
    params: accountId ? { account_id: accountId } : {},
  });
  return data.payload;
};

export const createTreasuryLaunchMe = async (payload) => {
  const { data } = await api.post("/treasury-launch/me", payload);
  return data.payload;
};
