import {
  Shield,
  DollarSign,
  CheckSquare,
  TrendingUp,
  Clock,
  Flame,
} from "lucide-react";

export const columns: ColumnDefinition[] = [
  {
    key: "id",
    title: "ID",
    type: "text",
    icon: Shield,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Unique identifier for the exchange market",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "currency",
    title: "Currency",
    type: "text",
    icon: DollarSign,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Base currency",
    priority: 1,
  },
  {
    key: "pair",
    title: "Pair",
    type: "text",
    icon: DollarSign,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Quote currency",
    priority: 1,
  },
  {
    key: "symbol",
    title: "Symbol",
    type: "text",
    icon: TrendingUp,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: false,
    usedInCreate: false,
    description: "Trading pair symbol",
    priority: 1,
    render: {
      type: "custom",
      render: (value: any, row: any) => {
        const currency = row.currency || "";
        const pair = row.pair || "";
        return `${currency}/${pair}`;
      },
    },
  },
  {
    key: "isTrending",
    title: "Trending",
    type: "boolean",
    icon: TrendingUp,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Trending market flag",
    priority: 2,
  },
  {
    key: "isHot",
    title: "Hot",
    type: "boolean",
    icon: Flame,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Hot market flag",
    priority: 2,
    expandedOnly: true,
  },
  {
    key: "metadata.precision.price",
    title: "Price Precision",
    type: "number",
    icon: Shield,
    sortable: false,
    searchable: false,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Number of decimal places for price",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "metadata.precision.amount",
    title: "Amount Precision",
    type: "number",
    icon: Shield,
    sortable: false,
    searchable: false,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Number of decimal places for amount",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "metadata.taker",
    title: "Taker Fee (%)",
    type: "number",
    icon: DollarSign,
    sortable: false,
    searchable: false,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Taker fee percentage",
    priority: 2,
    expandedOnly: false,
    render: {
      type: "custom",
      render: (value: any) => {
        if (value === undefined || value === null) return "-";
        return `${(value * 100).toFixed(3)}%`;
      },
    },
  },
  {
    key: "metadata.maker",
    title: "Maker Fee (%)",
    type: "number",
    icon: DollarSign,
    sortable: false,
    searchable: false,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Maker fee percentage",
    priority: 2,
    expandedOnly: false,
    render: {
      type: "custom",
      render: (value: any) => {
        if (value === undefined || value === null) return "-";
        return `${(value * 100).toFixed(3)}%`;
      },
    },
  },
  {
    key: "status",
    title: "Status",
    type: "boolean",
    render: {
      type: "toggle",
      config: {
        url: "/api/admin/finance/exchange/market/[id]/status",
        method: "PUT",
        field: "status",
        trueValue: true,
        falseValue: false,
      },
    },
    icon: CheckSquare,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: false,
    usedInCreate: false,
    description: "Market status",
    priority: 1,
  },
  {
    key: "createdAt",
    title: "Created At",
    type: "date",
    icon: Clock,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Creation date",
    render: { type: "date", format: "PPP" },
    priority: 3,
    expandedOnly: true,
  },
];
