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

export interface Config {
  title: LocalizedText;
  limit: number;
  /** Scroll duration in seconds for one full loop. Larger = slower. */
  speedSeconds: number;
}

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

export const defaultConfig: Config = {
  title: { he: 'קרוסלה', en: 'Carousel' },
  limit: 10,
  speedSeconds: 135,
};

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