"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.slugifyBrand = exports.toBrandListItem = void 0;
const toBrandListItem = (row, media, productCount) => ({
    id: row.id,
    name: row.name,
    slug: row.slug,
    isActive: row.isActive,
    media: media.map((m) => ({
        id: m.id,
        url: m.url,
        altText: m.altText,
        isPrimary: m.isPrimary,
        sortOrder: m.sortOrder,
    })),
    productCount,
    createdAt: row.createdAt,
    updatedAt: row.updatedAt,
});
exports.toBrandListItem = toBrandListItem;
const slugifyBrand = (name) => {
    return name
        .toLowerCase()
        .trim()
        .replace(/[^a-z0-9\s-]/g, "")
        .replace(/\s+/g, "-")
        .replace(/-+/g, "-")
        .replace(/^-|-$/g, "");
};
exports.slugifyBrand = slugifyBrand;
//# sourceMappingURL=brandSerializers.js.map