import type { FilterFieldConfig } from "@/components/reui/filters"
import type { Server, ServerType } from "@/lib/data"

export const SERVER_FILTER_FIELDS: FilterFieldConfig[] = [
  {
    key: "country",
    label: "Страна",
    type: "multiselect",
    searchable: true,
    options: [
      { value: "RU", label: "RU" },
      { value: "DE", label: "DE" },
      { value: "NL", label: "NL" },
      { value: "SG", label: "SG" },
      { value: "FI", label: "FI" },
      { value: "US", label: "US" },
    ],
  },
  {
    key: "status",
    label: "Статус",
    type: "multiselect",
    options: [
      { value: "online", label: "Online" },
      { value: "degraded", label: "Degraded" },
      { value: "offline", label: "Offline" },
    ],
  },
  {
    key: "type",
    label: "Тип",
    type: "multiselect",
    options: [
      { value: "jump-host", label: "JumpHost" },
      { value: "exit-node", label: "Exit Node" },
      { value: "home-router", label: "Home Router" },
    ],
  },
]

export const SERVER_FILTER_ACCESSORS = {
  country: (s: Server) => s.country ?? "",
  status: (s: Server) => s.status,
  type: (s: Server) => s.type as ServerType,
}
