"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.slugifyProductType = exports.toProductTypeListItem = void 0;
const toProductTypeListItem = (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.toProductTypeListItem = toProductTypeListItem;
const slugifyProductType = (name) => {
    return name
        .toLowerCase()
        .trim()
        .replace(/[^a-z0-9\s-]/g, "")
        .replace(/\s+/g, "-")
        .replace(/-+/g, "-")
        .replace(/^-|-$/g, "");
};
exports.slugifyProductType = slugifyProductType;
//# sourceMappingURL=productTypeSerializers.js.map