import { z } from 'zod';

export const newsItemSchema = z.object({
  id: z.union([z.string(), z.number()]),
  title: z.string(),
  slug: z.string(),
  summary: z.string(),
  content: z.string(),
  imageUrl: z.string().url().optional().nullable(),
  publishedAt: z.string().optional().nullable(),
  status: z.enum(['draft', 'published', 'archived']).default('draft'),
});

export type NewsItem = z.infer<typeof newsItemSchema>;

export const newsListSchema = z.array(newsItemSchema);

export type NewsListResponse = z.infer<typeof newsListSchema>;

export const newsPageSchema = z.object({
  items: newsListSchema,
  total: z.number(),
  limit: z.number(),
  offset: z.number(),
});

export type NewsPageResponse = z.infer<typeof newsPageSchema>;
