/**
 * Post & Comment DTOs
 */

import type { UserDTO } from './user';
import type { MessageSegment } from './message';

export interface PostImageDTO {
  id: string;
  url: string;
  thumbnail_url: string;
  preview_url: string;
  preview_url_large: string;
  width: number;
  height: number;
}

export interface PostChannelBriefDTO {
  id: string;
  name: string;
}

export interface PostDTO {
  id: string;
  user_id: string;
  title: string;
  content: string;
  segments?: MessageSegment[];
  images: PostImageDTO[];
  status?: string;
  likes_count: number;
  comments_count: number;
  favorites_count: number;
  shares_count: number;
  views_count: number;
  is_pinned: boolean;
  is_locked: boolean;
  is_vote: boolean;
  created_at: string;
  updated_at?: string;
  content_edited_at?: string;
  author: UserDTO | null;
  is_liked: boolean;
  is_favorited: boolean;
  channel_id?: string;
  channel?: PostChannelBriefDTO | null;
  top_comment?: CommentDTO | null;
}

export interface PostDetailDTO extends PostDTO {
  status: string;
  updated_at: string;
}

export interface CommentImageDTO {
  url: string;
}

export interface CommentDTO {
  id: string;
  post_id: string;
  user_id: string;
  parent_id: string | null;
  root_id: string | null;
  content: string;
  segments?: MessageSegment[];
  images: CommentImageDTO[];
  likes_count: number;
  replies_count: number;
  created_at: string;
  author: UserDTO;
  is_liked: boolean;
  target_id?: string | null;
  replies?: CommentDTO[];
}