import {
  Shield,
  User,
  DollarSign,
  ClipboardList,
  CalendarIcon,
} 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 order",
    priority: 2,
    expandedOnly: true,
  },
  {
    key: "referenceId",
    title: "Reference ID",
    type: "text",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "External reference ID",
    priority: 2,
    expandedOnly: true,
  },
  {
    key: "user",
    title: "User",
    type: "compound",
    icon: User,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Investor details",
    render: {
      type: "compound",
      config: {
        image: {
          key: "avatar",
          fallback: "/img/placeholder.svg",
          type: "image",
          title: "Avatar",
          description: "User avatar",
          editable: false,
          usedInCreate: false,
        },
        primary: {
          key: ["firstName", "lastName"],
          title: ["First Name", "Last Name"],
          description: ["Investor's first name", "Investor's last name"],
          editable: false,
          usedInCreate: false,
          icon: User,
        },
        secondary: {
          key: "email",
          title: "Email",
          icon: ClipboardList,
          editable: false,
          usedInCreate: false,
        },
      },
    },
    priority: 1,
  },
  {
    key: "symbol",
    title: "Symbol",
    type: "text",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Trading symbol",
    priority: 1,
  },
  {
    key: "type",
    title: "Order Type",
    type: "select",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Market or Limit",
    options: [
      { value: "MARKET", label: "Market" },
      { value: "LIMIT", label: "Limit" },
    ],
    priority: 1,
  },
  {
    key: "timeInForce",
    title: "Time In Force",
    type: "select",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "GTC, IOC, FOK, or PO",
    options: [
      { value: "GTC", label: "GTC" },
      { value: "IOC", label: "IOC" },
      { value: "FOK", label: "FOK" },
      { value: "PO", label: "PO" },
    ],
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "side",
    title: "Side",
    type: "select",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Buy or Sell",
    options: [
      { value: "BUY", label: "Buy" },
      { value: "SELL", label: "Sell" },
    ],
    priority: 1,
  },
  {
    key: "price",
    title: "Price",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Order price",
    priority: 1,
  },
  {
    key: "amount",
    title: "Amount",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    description: "Order amount",
    priority: 1,
  },
  {
    key: "filled",
    title: "Filled",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    description: "Filled amount",
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "remaining",
    title: "Remaining",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    description: "Remaining amount",
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "cost",
    title: "Cost",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    description: "Total cost",
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "fee",
    title: "Fee",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    description: "Transaction fee",
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "feeCurrency",
    title: "Fee Currency",
    type: "text",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Fee currency",
    priority: 1,
    expandedOnly: true,
  },
  {
    key: "status",
    title: "Status",
    type: "select",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Order status",
    options: [
      { value: "OPEN", label: "Open" },
      { value: "CLOSED", label: "Closed" },
      { value: "CANCELED", label: "Canceled" },
      { value: "EXPIRED", label: "Expired" },
      { value: "REJECTED", label: "Rejected" },
    ],
    render: {
      type: "badge",
      config: {
        variant: (value) => {
          const statusMap = {
            OPEN: "warning",
            CLOSED: "success",
            CANCELED: "muted",
            EXPIRED: "danger",
            REJECTED: "danger",
          };
          return statusMap[value.toUpperCase()] || "default";
        },
      },
    },
    priority: 1,
  },
  {
    key: "createdAt",
    title: "Created At",
    type: "date",
    icon: CalendarIcon,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Order creation date",
    priority: 2,
    expandedOnly: true,
    render: { type: "date", format: "PPP", fullDate: true },
  },
];
