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

export interface GetSalesPriceListInput {
  id: string;
}

export async function run(db: ReadonlyDB<DB>, input: GetSalesPriceListInput) {
  const salesPriceList = await db
    .selectFrom("SalesPriceList")
    .selectAll()
    .where("id", "=", input.id)
    .executeTakeFirst();
  return ok({ salesPriceList: salesPriceList ?? null });
}
