import { Shield, ClipboardList, DollarSign, User, Key, Mail } from "lucide-react";

export const columns: ColumnDefinition[] = [
  {
    key: "id",
    title: "ID",
    type: "text",
    icon: Shield,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Unique account identifier",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "user",
    title: "User",
    type: "compound",
    icon: User,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Account owner",
    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: ["User's first name", "User's last name"],
          editable: false,
          usedInCreate: false,
          icon: User,
        },
        secondary: {
          key: "email",
          title: "Email",
          icon: Mail,
          editable: false,
          usedInCreate: false,
        },
      },
    },
    priority: 1,
  },
  {
    key: "userId",
    title: "User",
    type: "select",
    icon: User,
    sortable: false,
    searchable: false,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Select account owner",
    priority: 1,
    expandedOnly: true,
    apiEndpoint: {
      url: "/api/admin/crm/user/options",
      method: "GET",
    },
  },
  {
    key: "accountId",
    title: "Account ID",
    type: "text",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Broker account number",
    priority: 1,
  },
  {
    key: "broker",
    title: "Broker",
    type: "text",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Broker name",
    priority: 1,
  },
  {
    key: "mt",
    title: "MT Version",
    type: "select",
    icon: Key,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "MT version",
    priority: 2,
    expandedOnly: true,
    options: [
      { value: "4", label: "MT4" },
      { value: "5", label: "MT5" },
    ],
  },
  {
    key: "balance",
    title: "Balance",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Current balance",
    priority: 1,
  },
  {
    key: "leverage",
    title: "Leverage",
    type: "number",
    icon: DollarSign,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Account leverage",
    priority: 2,
    expandedOnly: true,
  },
  {
    key: "type",
    title: "Type",
    type: "select",
    icon: ClipboardList,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "DEMO or LIVE",
    options: [
      { value: "DEMO", label: "Demo" },
      { value: "LIVE", label: "Live" },
    ],
    priority: 1,
    render: {
      type: "badge",
      config: {
        variant: (value: any) => {
          switch (value) {
            case "DEMO":
              return "secondary";
            case "LIVE":
              return "success";
            default:
              return "primary";
          }
        },
      },
    },
  },
  {
    key: "status",
    title: "Status",
    type: "toggle",
    icon: Shield,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Account status",
    priority: 1,
  },
];
