export type ServerStatus = "online" | "offline" | "maintenance" | "restarting" | "full";

export interface GameServer {
  id: string;
  name: string;
  ip: string;
  port: number;
  mode: string;
  map: string;
  nextMap: string;
  region: string;
  players: number;
  maxPlayers: number;
  ping: number;
  tickrate: number;
  status: ServerStatus;
  ctScore: number;
  tScore: number;
  timeRemaining: string;
  uptime: string;
  passwordProtected: boolean;
}

export interface Player {
  id: string;
  steamId: string;
  name: string;
  country: string;
  avatar: string;
  rank: string;
  level: number;
  rating: string;
  kills: number;
  deaths: number;
  kd: string;
  headshotPct: number;
  mvps: number;
  wins: number;
  playtimeHours: number;
  onlineStatus: "online" | "offline" | "in-server";
  currentServer: string | null;
  privileges: string[];
  lastSeen: string;
}

export interface Punishment {
  id: string;
  playerName: string;
  playerId: string;
  steamId: string;
  type: "ban" | "mute" | "gag" | "silence" | "warning";
  reason: string;
  admin: string;
  server: string;
  issuedAt: string;
  expiresAt: string;
  duration: string;
  remaining: string;
  status: "active" | "expired" | "removed" | "appealed" | "review";
  hasEvidence: boolean;
}

export interface StoreProduct {
  id: string;
  name: string;
  category: string;
  price: number;
  oldPrice?: number;
  image: string;
  description: string;
  duration: string;
  featured?: boolean;
  popular?: boolean;
}

export interface NewsArticle {
  id: string;
  slug: string;
  title: string;
  category: string;
  excerpt: string;
  cover: string;
  author: string;
  date: string;
  readMin: number;
  views: number;
}

export interface RankingEntry {
  position: number;
  change: number;
  player: Player;
  rating: number;
  points: number;
}

export interface Notification {
  id: string;
  type: "message" | "purchase" | "expiry" | "punishment" | "news" | "system";
  title: string;
  body: string;
  time: string;
  read: boolean;
}

export interface PlatformStats {
  totalPlayers: number;
  onlineWebsite: number;
  onlineServers: number;
  totalServers: number;
  activeServers: number;
  totalBans: number;
  activeBans: number;
  totalMutes: number;
  activeMutes: number;
  roundsPlayed: number;
  totalPurchases: number;
}

export interface Slide {
  id: string;
  enabled: boolean;
  order: number;
  mediaType: "image" | "video";
  mediaUrl: string;
  label?: string;
  title: string;
  description: string;
  primary?: { label: string; to: string; visible: boolean };
  secondary?: { label: string; to: string; visible: boolean };
  accent: string;
}

export type AppealStatus = "submitted" | "under_review" | "more_info" | "approved" | "rejected" | "closed";

export interface AppealMessage {
  id: string;
  author: string;
  role: "player" | "admin" | "system";
  time: string;
  body: string;
}

export interface Appeal {
  id: string;
  punishmentId: string;
  playerId: string;
  playerName: string;
  reason: string;
  explanation: string;
  evidenceLinks: string[];
  attachments: { name: string; size: number; url: string }[];
  videoUrl?: string;
  status: AppealStatus;
  assignedAdmin?: string;
  createdAt: string;
  updatedAt: string;
  messages: AppealMessage[];
  timeline: { time: string; label: string }[];
}

export type ReportCategory =
  | "cheating" | "toxic" | "voice_abuse" | "text_abuse" | "griefing"
  | "team_kill" | "bug_exploit" | "advertising" | "impersonation"
  | "scamming" | "inappropriate_profile" | "other";

export type ReportStatus = "submitted" | "pending_review" | "investigating" | "more_info" | "resolved" | "rejected";

export interface PlayerReport {
  id: string;
  reporterId: string;
  reportedPlayerId: string;
  reportedPlayerName: string;
  category: ReportCategory;
  serverId?: string;
  matchId?: string;
  incidentAt: string;
  description: string;
  evidenceLinks: string[];
  attachments: { name: string; size: number; url: string }[];
  relatedMessage?: string;
  status: ReportStatus;
  priority: "low" | "normal" | "high" | "urgent";
  assignedAdmin?: string;
  createdAt: string;
  duplicateOf?: string;
  timeline: { time: string; label: string }[];
}

export type PromoDiscountType = "percentage" | "fixed" | "free_item";
export type PromoScopeType =
  | "any" | "category" | "server" | "subscription" | "first_purchase" | "limited_use";

export interface PromoCode {
  id: string;
  code: string;
  description?: string;
  enabled: boolean;
  discountType: PromoDiscountType;
  discountValue: number;
  scope: PromoScopeType;
  scopeValue?: string;
  minOrder?: number;
  usageLimit?: number;
  perUserLimit?: number;
  usedCount: number;
  revenue: number;
  startsAt?: string;
  endsAt?: string;
  userAllowlist?: string[];
  firstPurchaseOnly?: boolean;
}

export type PurchaseType = "product" | "privilege" | "subscription" | "balance" | "marketplace" | "bundle" | "gift";

export interface PurchaseContext {
  purchaseType: PurchaseType;
  itemId: string;
  itemName: string;
  price: number;
  quantity?: number;
  duration?: string;
  serverId?: string;
  recipientId?: string;
  metadata?: Record<string, unknown>;
}

export type SubscriptionStatus = "active" | "expiring_soon" | "expired" | "cancelled" | "payment_failed" | "gifted" | "paused";

export interface SubscriptionPlan {
  id: string;
  label: string;
  durationDays: number;
  price: number;
  originalPrice?: number;
  savingsPct?: number;
  lifetime?: boolean;
  visible: boolean;
}

export interface Subscription {
  id: string;
  userId: string;
  planId: string;
  status: SubscriptionStatus;
  startsAt: string;
  expiresAt: string;
  autoRenew: boolean;
  giftedBy?: string;
  paymentHistory: { id: string; date: string; amount: number; status: "paid" | "failed" | "refunded" }[];
  promoUsed?: string;
}

export interface SubscriptionSettings {
  badgeVisibleProfile: boolean;
  badgeVisibleChat: boolean;
  badgeVisibleRankings: boolean;
  badgeVisibleScoreboard: boolean;
  nicknameColor: string;
  chatAccent: string;
  tagColor: string;
  profileAccent: string;
  showMedal: boolean;
  badgeOrder: number;
  profileBackground: string;
  notifyDailyRewards: boolean;
  notifyMarketplace: boolean;
  notifyRenewal: boolean;
}
