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

export interface GetProductAttributeValueInput {
  id: string;
}

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

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