import { createCoreAPIClient } from "../coreClient";
import type { MembershipAccountType } from "./models";

const coreClient = createCoreAPIClient();

export async function createMembershipAccountType(
  payload: Omit<MembershipAccountType, "id">,
) {
  const response = await coreClient<null>(
    "/v1/admin/memberships/account-types",
    {
      method: "PATCH",
      body: JSON.stringify(payload),
    },
  );
  return response;
}

export async function updateMembershipAccountType(
  id: string,
  payload: Omit<MembershipAccountType, "id">,
) {
  const response = await coreClient<null>(
    `/v1/admin/memberships/account-types/${id}`,
    {
      method: "PATCH",
      body: JSON.stringify(payload),
    },
  );
  return response;
}
