import { ok, type ReadonlyDB } from "@tailor-platform/erp-kit/core";
import type { DB } from "../generated/kysely-tailordb";

export interface GetPartnerBankAccountInput {
  id: string;
}

export async function run(db: ReadonlyDB<DB>, input: GetPartnerBankAccountInput) {
  const partnerBankAccount = await db
    .selectFrom("PartnerBankAccount")
    .selectAll()
    .where("id", "=", input.id)
    .executeTakeFirst();

  return ok({ partnerBankAccount: partnerBankAccount ?? null });
}
