/**
 * WithYou - Core Type Definitions
 */

export * from './dto';
export * from './schedule';
export * from './material';
export * from './trade';

import type {
  UserDTO,
  PostDTO,
  PostImageDTO,
  MessageSegment,
  ConversationResponse,
  MessageResponse,
} from './dto';

// ============================================
// Backward-compat aliases — prefer DTO names directly
// ============================================

export type User = UserDTO;
export type Post = PostDTO;
export type PostImage = PostImageDTO;
export type Conversation = ConversationResponse;
export type Message = MessageResponse;

export type { VoteOptionDTO as VoteOption, VoteResultDTO as VoteResult, CreateVotePostRequest as CreateVotePostReq } from './dto';

export interface CreatePostInput {
  title: string;
  content?: string;
  segments?: MessageSegment[];
  images?: string[];
  channel_id?: string;
}

// ============================================
// Comment Types
// ============================================

export interface CommentImage {
  url: string;
}

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

export interface CreateCommentInput {
  postId: string;
  parentId?: string;
  content: string;
  images?: string[];
  replyToUserId?: string;
}

// ============================================
// Notification Types
// ============================================

export type NotificationType =
  | 'like_post'
  | 'like_comment'
  | 'comment'
  | 'reply'
  | 'follow'
  | 'mention'
  | 'system';

export interface Notification {
  id: string;
  userId: string;
  type: NotificationType;
  title: string;
  content: string;
  data: {
    postId?: string;
    commentId?: string;
    userId?: string;
    [key: string]: unknown;
  };
  isRead: boolean;
  createdAt: string;
}

export interface NotificationBadge {
  total: number;
  likes: number;
  comments: number;
  follows: number;
  system: number;
}