export type Category =
  | 'ELECTRONICS'
  | 'FURNITURE'
  | 'CLOTHING'
  | 'HOME_GARDEN'
  | 'SPORTS'
  | 'BOOKS'
  | 'GAMES'
  | 'VEHICLES'
  | 'OTHER';

export type ListingCondition = 'NEW' | 'LIKE_NEW' | 'GENTLY_USED' | 'USED' | 'FAIR';

export type ListingStatus = 'DRAFT' | 'ACTIVE' | 'SOLD' | 'DELETED';

export type OfferStatus = 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'COUNTERED';

export type NotificationType = 'NEW_OFFER' | 'OFFER_ACCEPTED' | 'OFFER_DECLINED' | 'ITEM_SOLD' | 'NEW_MESSAGE' | 'ITEM_FAVORITED';

export interface User {
  id: string;
  email: string;
  fullName: string;
  nickname?: string;
  avatar?: string;
  phone?: string;
  location?: string;
  bio?: string;
  rating?: number;
  createdAt: string;
  showEmail: boolean;
  showPhone: boolean;
  showLocation: boolean;
}

export interface ListingImage {
  id: string;
  url: string;
  order: number;
}

export interface Listing {
  id: string;
  title: string;
  description: string;
  price: number;
  obo: boolean;
  category: Category;
  condition: ListingCondition;
  status: ListingStatus;
  location: string;
  viewCount: number;
  images: ListingImage[];
  seller: User;
  sellerId: string;
  isFavorited?: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface Offer {
  id: string;
  amount: number;
  message?: string;
  status: OfferStatus;
  counterAmount?: number;
  buyer: User;
  buyerId: string;
  seller: User;
  sellerId: string;
  listing: Listing;
  listingId: string;
  createdAt: string;
  updatedAt: string;
}

export interface Message {
  id: string;
  content: string;
  senderId: string;
  conversationId: string;
  isRead: boolean;
  offerAmount?: number;
  createdAt: string;
}

export interface Conversation {
  id: string;
  user1: User;
  user2: User;
  listing?: Listing;
  lastMessage?: Message;
  unreadCount: number;
  updatedAt: string;
}

export interface Notification {
  id: string;
  type: NotificationType;
  title: string;
  body: string;
  data?: Record<string, unknown>;
  isRead: boolean;
  createdAt: string;
}

export interface AuthResponse {
  user: User;
  accessToken: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}
