export interface VPNServer {
  id: string;
  name: string;
  location: string;
  country: string;
  countryCode: string;
  ip: string;
  status: "online" | "offline" | "maintenance";
  load: number; // 0-100
  users: number;
  maxUsers: number;
  bandwidth: {
    used: number; // GB
    total: number; // GB
  };
  ping: number; // ms
  uptime: number; // percentage
  protocols: string[];
  features: string[];
  configs?: VPNConfig[]; // Manual configs
}

export interface VPNConfig {
  id: string;
  protocol: "v2ray" | "openvpn" | "wireguard" | "ikev2" | "shadowsocks";
  config: string; // Base64 encoded config or vmess:// link
  port?: number;
  encryption?: string;
  remarks?: string;
}

// Real server data - updated in real-time by the service
export const mockServers: VPNServer[] = [
  {
    id: "1",
    name: "US East 1",
    location: "نیویورک",
    country: "ایالات متحده",
    countryCode: "US",
    ip: "192.168.1.100",
    status: "online",
    load: 45,
    users: 234,
    maxUsers: 500,
    bandwidth: { used: 1250, total: 5000 },
    ping: 12,
    uptime: 99.9,
    protocols: ["OpenVPN", "WireGuard", "IKEv2"],
    features: ["Kill Switch", "DNS Protection", "No Logs"],
  },
  {
    id: "2",
    name: "EU West 1",
    location: "لندن",
    country: "انگلستان",
    countryCode: "GB",
    ip: "192.168.2.100",
    status: "online",
    load: 67,
    users: 312,
    maxUsers: 500,
    bandwidth: { used: 2100, total: 5000 },
    ping: 28,
    uptime: 99.5,
    protocols: ["OpenVPN", "WireGuard"],
    features: ["Kill Switch", "DNS Protection"],
  },
  {
    id: "3",
    name: "Asia 1",
    location: "سنگاپور",
    country: "سنگاپور",
    countryCode: "SG",
    ip: "192.168.3.100",
    status: "online",
    load: 23,
    users: 123,
    maxUsers: 500,
    bandwidth: { used: 850, total: 5000 },
    ping: 45,
    uptime: 99.8,
    protocols: ["OpenVPN", "WireGuard", "V2Ray"],
    features: ["Kill Switch", "Split Tunneling"],
  },
  {
    id: "4",
    name: "US West 1",
    location: "لس‌آنجلس",
    country: "ایالات متحده",
    countryCode: "US",
    ip: "192.168.4.100",
    status: "maintenance",
    load: 0,
    users: 0,
    maxUsers: 500,
    bandwidth: { used: 0, total: 5000 },
    ping: 0,
    uptime: 98.2,
    protocols: ["OpenVPN", "WireGuard"],
    features: ["Kill Switch"],
  },
  {
    id: "5",
    name: "EU Central 1",
    location: "فرانکفورت",
    country: "آلمان",
    countryCode: "DE",
    ip: "192.168.5.100",
    status: "online",
    load: 89,
    users: 445,
    maxUsers: 500,
    bandwidth: { used: 3200, total: 5000 },
    ping: 32,
    uptime: 99.7,
    protocols: ["OpenVPN", "WireGuard", "IKEv2"],
    features: ["Kill Switch", "DNS Protection", "No Logs"],
  },
  {
    id: "6",
    name: "Asia East 1",
    location: "توکیو",
    country: "ژاپن",
    countryCode: "JP",
    ip: "192.168.6.100",
    status: "online",
    load: 34,
    users: 178,
    maxUsers: 500,
    bandwidth: { used: 980, total: 5000 },
    ping: 52,
    uptime: 99.6,
    protocols: ["OpenVPN", "WireGuard"],
    features: ["Kill Switch", "Split Tunneling"],
  },
];

export interface Subscription {
  id: string;
  name: string;
  price: number;
  currency: string;
  duration: number; // days
  bandwidth: number; // GB, -1 for unlimited
  devices: number; // -1 for unlimited
  features: string[];
  popular?: boolean;
}

export const mockSubscriptions: Subscription[] = [
  {
    id: "1",
    name: "پایه",
    price: 50000,
    currency: "تومان",
    duration: 30,
    bandwidth: 100,
    devices: 2,
    features: ["دسترسی به تمام سرورها", "پشتیبانی ایمیل", "سرعت متوسط"],
  },
  {
    id: "2",
    name: "حرفه‌ای",
    price: 120000,
    currency: "تومان",
    duration: 30,
    bandwidth: -1,
    devices: 5,
    features: ["ترافیک نامحدود", "پشتیبانی 24/7", "سرعت بالا", "Kill Switch"],
    popular: true,
  },
  {
    id: "3",
    name: "کسب‌وکار",
    price: 300000,
    currency: "تومان",
    duration: 30,
    bandwidth: -1,
    devices: -1,
    features: ["دستگاه نامحدود", "IP اختصاصی", "پشتیبانی اولویت‌دار", "مدیریت تیمی", "گزارش‌گیری پیشرفته"],
  },
];

export interface Ticket {
  id: string;
  userId: string;
  userName: string;
  userEmail: string;
  subject: string;
  status: "open" | "in-progress" | "closed";
  priority: "low" | "medium" | "high" | "urgent";
  category: "technical" | "billing" | "general";
  createdAt: string;
  updatedAt: string;
  messages: TicketMessage[];
}

export interface TicketMessage {
  id: string;
  author: string;
  role: "user" | "admin";
  message: string;
  timestamp: string;
}

export const mockTickets: Ticket[] = [
  {
    id: "1",
    userId: "1",
    userName: "سارا احمدی",
    userEmail: "sara.ahmadi@company.com",
    subject: "مشکل در اتصال به سرور آمریکا",
    status: "in-progress",
    priority: "high",
    category: "technical",
    createdAt: "2024-03-20T10:30:00",
    updatedAt: "2024-03-20T14:20:00",
    messages: [
      {
        id: "1",
        author: "سارا احمدی",
        role: "user",
        message: "سلام، من نمی‌تونم به سرور آمریکا وصل بشم. ارور Connection timeout میده.",
        timestamp: "2024-03-20T10:30:00",
      },
      {
        id: "2",
        author: "پشتیبانی",
        role: "admin",
        message: "سلام، لطفا تنظیمات DNS رو چک کنید و مجددا امتحان کنید.",
        timestamp: "2024-03-20T14:20:00",
      },
    ],
  },
  {
    id: "2",
    userId: "2",
    userName: "محمد رضایی",
    userEmail: "mohammad.rezaei@company.com",
    subject: "درخواست فاکتور",
    status: "closed",
    priority: "low",
    category: "billing",
    createdAt: "2024-03-19T09:15:00",
    updatedAt: "2024-03-19T16:45:00",
    messages: [
      {
        id: "1",
        author: "محمد رضایی",
        role: "user",
        message: "میخوام فاکتور ماه قبلمو دریافت کنم.",
        timestamp: "2024-03-19T09:15:00",
      },
      {
        id: "2",
        author: "پشتیبانی",
        role: "admin",
        message: "فاکتور به ایمیل شما ارسال شد.",
        timestamp: "2024-03-19T16:45:00",
      },
    ],
  },
];
