// All `id` fields come from backend snowflake int64. // Frontend stores them as strings to avoid JS number precision issues. export type SnowflakeId = string export type UserRole = "consumer" | "player" | "owner" | "admin" export type VerificationStatus = "pending" | "approved" | "rejected" export interface User { id: SnowflakeId username: string email?: string nickname: string avatar: string role: UserRole verifiedRoles?: UserRole[] verificationStatus?: Partial> phone?: string bio?: string createdAt: string } export interface Game { id: SnowflakeId name: string icon: string category: "MOBA" | "FPS" | "动作" | "RPG" } export interface PlayerService { id: SnowflakeId playerId: SnowflakeId gameId: SnowflakeId gameName: string title: string description: string price: number unit: string rankRange?: string availability: string[] } export interface Player { id: SnowflakeId user: User rating: number totalOrders: number completionRate: number status: "available" | "busy" | "offline" games: string[] services: PlayerService[] shopId?: SnowflakeId shopName?: string tags: string[] } export interface Shop { id: SnowflakeId owner: User name: string banner?: string description: string rating: number totalOrders: number playerCount: number commissionType: "fixed" | "percentage" commissionValue: number allowMultiShop: boolean allowIndependentOrders: boolean dispatchMode: "manual" | "auto" announcements: string[] templateConfig: ShopTemplateConfig } export interface ShopTemplateConfig { sections: ShopSection[] } export interface ShopSection { type: "banner" | "intro" | "services" | "players" | "announcements" | "reviews" enabled: boolean order: number } export type OrderStatus = | "pending_payment" | "pending_accept" | "in_progress" | "pending_close" | "pending_review" | "disputed" | "completed" | "cancelled" export interface Order { id: SnowflakeId consumerId: SnowflakeId consumerName: string playerId: SnowflakeId playerName: string shopId?: SnowflakeId shopName?: string service: PlayerService status: OrderStatus totalPrice: number note?: string createdAt: string acceptedAt?: string closedAt?: string completedAt?: string } export interface Review { id: SnowflakeId orderId: SnowflakeId fromUserId: SnowflakeId fromUserName: string fromUserAvatar: string toUserId: SnowflakeId rating: number content?: string sealed: boolean createdAt: string } export interface Dispute { id: SnowflakeId orderId: SnowflakeId initiatorId: SnowflakeId initiatorName: string reason: string evidence: string[] status: "open" | "reviewing" | "resolved" | "appealed" result?: "full_refund" | "full_payment" | "partial_refund" createdAt: string } interface BaseChatSession { id: SnowflakeId participants: { id: SnowflakeId; name: string; avatar: string }[] lastMessage?: string lastMessageAt?: string unreadCount: number readonly: boolean } export interface OrderChatSession extends BaseChatSession { type: "order" orderId: SnowflakeId } export interface ConsultationChatSession extends BaseChatSession { type: "consultation" orderId?: never } export type ChatSession = OrderChatSession | ConsultationChatSession export interface ChatMessage { id: SnowflakeId sessionId: SnowflakeId senderId: SnowflakeId senderName: string senderAvatar: string type: "text" | "image" | "system" content: string createdAt: string } export interface Post { id: SnowflakeId author: User authorRole: UserRole title: string content: string images: string[] tags: string[] linkedOrderId?: SnowflakeId quotedPostId?: SnowflakeId likeCount: number commentCount: number liked: boolean pinned: boolean createdAt: string } export interface Comment { id: SnowflakeId postId: SnowflakeId author: User content: string likeCount: number liked: boolean createdAt: string } export interface Notification { id: SnowflakeId type: "order" | "community" | "system" title: string content: string read: boolean link?: string createdAt: string } export interface WalletTransaction { id: SnowflakeId type: "topup" | "payment" | "income" | "withdrawal" | "refund" amount: number description: string createdAt: string } export interface Favorite { id: SnowflakeId userId: SnowflakeId targetType: "player" | "shop" targetId: SnowflakeId createdAt: string }