import { z } from 'zod';
import type { LocalizedText } from '@/server/page-layout/types';

export interface Config {
  title: LocalizedText;
  categoryId: string;
  categorySlug: string;
  categoryName: LocalizedText;
  limit: number;
}

export const configSchema: z.ZodType<Config> = z.object({
  title: z.object({ he: z.string().min(1), en: z.string().min(1) }),
  categoryId: z.string(),
  categorySlug: z.string(),
  categoryName: z.object({ he: z.string(), en: z.string() }),
  limit: z.number().int().min(1).max(30),
});

export const defaultConfig: Config = {
  title: { he: 'קטגוריה', en: 'Category' },
  categoryId: '',
  categorySlug: '',
  categoryName: { he: '', en: '' },
  limit: 10,
};

export const type = 'deal-row:category' as const;
export const category = 'deal-row' as const;
export const labelKey = 'module_labels.deal-row:category' as const;
