// Auto-generated blog data exports
import blogPostsData from './blog-posts.json';
import pagesData from './pages.json';

export interface BlogPost {
  id: number;
  title: string;
  slug: string;
  link: string;
  content: string;
  excerpt: string;
  featuredImage: string | null;
  images: string[];
  pubDate: string;
  postDate: string;
  status: string;
}

export interface Page {
  id: number;
  title: string;
  slug: string;
  link: string;
  content: string;
  excerpt: string;
  featuredImage: string | null;
  images: string[];
  pubDate: string;
  postDate: string;
  status: string;
}

export const blogPosts: BlogPost[] = blogPostsData as BlogPost[];
export const pages: Page[] = pagesData as Page[];

export function getBlogPostBySlug(slug: string): BlogPost | undefined {
  return blogPosts.find(post => post.slug === slug);
}

export function getPageBySlug(slug: string): Page | undefined {
  return pages.find(page => page.slug === slug);
}

export function getAllBlogSlugs(): string[] {
  return blogPosts.map(post => post.slug);
}

export function getRecentPosts(limit: number = 10): BlogPost[] {
  return blogPosts.slice(0, limit);
}
