Files
juwan-frontend/lib/types.ts
T

195 lines
3.6 KiB
TypeScript

export type UserRole = "consumer" | "player" | "owner"
export interface User {
id: string
username: string
nickname: string
avatar: string
role: UserRole
phone?: string
bio?: string
createdAt: string
}
export interface Game {
id: string
name: string
icon: string
category: string
}
export interface PlayerService {
id: string
playerId: string
gameId: string
gameName: string
title: string
description: string
price: number
unit: string
rankRange?: string
availability: string[]
}
export interface Player {
id: string
user: User
rating: number
totalOrders: number
completionRate: number
status: "available" | "busy" | "offline"
games: string[]
services: PlayerService[]
shopId?: string
shopName?: string
tags: string[]
}
export interface Shop {
id: string
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: string
consumerId: string
consumerName: string
playerId: string
playerName: string
shopId?: string
shopName?: string
service: PlayerService
status: OrderStatus
totalPrice: number
note?: string
createdAt: string
acceptedAt?: string
closedAt?: string
completedAt?: string
}
export interface Review {
id: string
orderId: string
fromUserId: string
fromUserName: string
fromUserAvatar: string
toUserId: string
rating: number
content?: string
sealed: boolean
createdAt: string
}
export interface Dispute {
id: string
orderId: string
initiatorId: string
initiatorName: string
reason: string
evidence: string[]
status: "open" | "reviewing" | "resolved" | "appealed"
result?: "full_refund" | "full_payment" | "partial_refund"
createdAt: string
}
export interface ChatSession {
id: string
type: "consultation" | "order"
orderId?: string
participants: { id: string; name: string; avatar: string }[]
lastMessage?: string
lastMessageAt?: string
unreadCount: number
readonly: boolean
}
export interface ChatMessage {
id: string
sessionId: string
senderId: string
senderName: string
senderAvatar: string
type: "text" | "image" | "system"
content: string
createdAt: string
}
export interface Post {
id: string
author: User
authorRole: UserRole
title: string
content: string
images: string[]
tags: string[]
linkedOrderId?: string
quotedPostId?: string
likeCount: number
commentCount: number
liked: boolean
pinned: boolean
createdAt: string
}
export interface Comment {
id: string
postId: string
author: User
content: string
likeCount: number
liked: boolean
createdAt: string
}
export interface Notification {
id: string
type: "order" | "community" | "system"
title: string
content: string
read: boolean
link?: string
createdAt: string
}
export interface WalletTransaction {
id: string
type: "topup" | "payment" | "income" | "withdrawal" | "refund"
amount: number
description: string
createdAt: string
}