import { Comment } from 'src/types/comments';
import { Reaction } from 'src/types/reaction';
import { User } from 'src/types/user';

export type Article = {
  id: number;
  title: string;
  coverPicture: string;
  user: User;
  updatedAt: string;
  createdAt: string;
  commentCount: number;
  reactions: Reaction[];
  position: number | null;
  widgetId: any | null;
  body?: string;
  topics?: ArticleTopics[];
  publicationDateTime: string;
};

// Response
export type NewsNotificationsResponse = {
  articleNotifications: number;
};

// Sockets
export type ArticleReactionSocket = {
  userId: number;
  articleId: number;
  emoji: string;
  unified: string;
};

export type ArticleCommentReactionSocket = {
  userId: number;
  articleId: number;
  commentId: number;
  emoji: string;
  unified: string;
};

export type ArticleCommentCreatedSocket = Comment & {
  articleId: number;
};

export type ArticleCommentUpdatedSocket = Comment & {
  articleId: number;
};

export type ArticleCommentDeletedSocket = {
  articleId: number;
  commentId: number;
  parentId: number | null;
};

export type ArticleTopics = {
  id: number;
  position: number;
  name: string;
};
