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

export interface Config {
  title?: LocalizedText;
  source: 'favorites' | 'all-stores' | 'ids';
  ids?: string[];
  limit: number;
}

export const configSchema: z.ZodType<Config> = z.object({
  title: z.object({ he: z.string(), en: z.string() }).optional(),
  source: z.enum(['favorites', 'all-stores', 'ids']),
  ids: z.array(z.uuid()).max(60).optional(),
  limit: z.number().int().min(1).max(60),
});

export const defaultConfig: Config = {
  source: 'all-stores',
  limit: 12,
};

export const type = 'merchant-grid' as const;
export const category = 'custom' as const;
export const labelKey = 'module_labels.merchant-grid' as const;
