import { ApiResponse } from "@/shared/types/SharedTypes";

export interface Author {
  id: string;
  firstName: string;
  lastName: string;
}

export interface Category {
  id: string;
  title: string;
  iconUrl: string;
}

export interface Blog {
  id: string;
  createdAt: string;
  title: string;
  slug: string;
  previewContent: string;
  imageUrl: string;
  metaTitle: string;
  metaDescription: string;
  viewCount: number;
  author: Author;
  category: Category;
  content: string;
  tags: string[];
}

export interface Pager {
  page: number;
  limit: number;
  totalItems: number;
  totalPages: number;
  prevPage: boolean;
  nextPage: boolean;
}

export type BlogResponse = ApiResponse<{
  pager: Pager;
  blogs: Blog[];
}>;

export type BlogPinnedResponse = ApiResponse<{
  blogs: Blog[];
}>;

export type BlogCategoryResponse = ApiResponse<{
  categories: Category[];
}>;

export type BlogCombinedResponse = ApiResponse<{
  pinnedBlogs: Blog[];
  mostVisitedBlogs: Blog[];
}>;

export type BlogStoreType = {
  selectedCategory: string;
  setSelectedCategory: (category: string) => void;
};

export type Comment = {
  id: string;
  createdAt: string;
  title: string;
  content: string;
  status: string;
  user: User;
};

export type User = {
  id: string;
  firstName: string;
  lastName: string;
  profilePic: string;
};

export type BlogSingleResponse = ApiResponse<{
  blog: Blog;
  comments: Comment[];
}>;

export type CreateBlogCommentType = {
  title: string;
  content: string;
};
