import { Name } from "@repo/rdx-ddd"; import { Result } from "@repo/rdx-utils"; import type { BrandInput, BrandProps } from "../domain/brand.aggregate"; import { BrandError, BrandInputSchema } from "../domain/brand.aggregate"; export function mapBrandInput(input: BrandInput, builtin = false): Result { const parsed = BrandInputSchema.safeParse(input); if (!parsed.success) { return Result.fail(new BrandError("INVALID_REQUEST")); } const name = Name.create(parsed.data.name, 100); if (!name.isSuccess) { return Result.fail(new BrandError("INVALID_REQUEST")); } return Result.ok({ name: name.data, active: parsed.data.active, builtin }); }