import {
  Shield,
  ClipboardList,
  CheckSquare,
  User,
  ImageIcon,
} from "lucide-react";

export const columns: ColumnDefinition[] = [
  // Hidden by default
  {
    key: "id",
    title: "ID",
    type: "text",
    icon: Shield,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Unique review identifier",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "comment",
    title: "Comment",
    type: "text",
    icon: ClipboardList,
    sortable: false,
    searchable: true,
    filterable: false,
    editable: true,
    usedInCreate: true,
    description: "Review comment",
    priority: 3,
    expandedOnly: true,
  },
  {
    key: "product",
    idKey: "id",
    labelKey: "name",
    title: "Product",
    baseKey: "productId",
    sortKey: "product.name",
    disablePrefixSort: true,
    type: "select",
    apiEndpoint: {
      url: "/api/admin/ecommerce/product/options",
      method: "GET",
    },
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Product details",
    render: {
      type: "compound",
      config: {
        image: {
          key: "image",
          title: "Image",
          type: "image",
          fallback: "/img/placeholder.svg",
          icon: ImageIcon,
          sortable: false,
          searchable: false,
          filterable: false,
          description: "Product image URL",
        },
        primary: {
          key: "name",
          title: "Name",
          type: "text",
          sortable: true,
          searchable: true,
          filterable: true,
          description: "Product name",
        },
        secondary: {
          key: "slug",
          title: "Slug",
          type: "text",
          sortable: true,
          searchable: true,
          filterable: true,
          description: "URL-friendly slug",
        },
      },
    },
  },
  {
    key: "user",
    title: "User",
    type: "compound",
    expandedTitle: (row) => `User: ${row.id}`,
    icon: User,
    sortable: true,
    searchable: true,
    filterable: true,
    description: "Investor",
    render: {
      type: "compound",
      config: {
        image: {
          key: "avatar",
          fallback: "/img/placeholder.svg",
          type: "image",
          title: "Avatar",
          description: "User's profile picture",
          filterable: false,
          sortable: false,
        },
        primary: {
          key: ["firstName", "lastName"],
          title: ["First Name", "Last Name"],
          icon: User,
          editable: false,
        },
        secondary: {
          key: "email",
          title: "Email",
          editable: false,
        },
      },
    },
    priority: 1,
  },
  {
    key: "rating",
    title: "Rating",
    type: "rating",
    icon: ClipboardList,
    sortable: true,
    searchable: false,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Rating (1-5)",
    priority: 1,
  },
  {
    key: "status",
    title: "Status",
    type: "boolean",
    icon: CheckSquare,
    sortable: true,
    searchable: true,
    filterable: true,
    editable: true,
    usedInCreate: true,
    description: "Review status",
    priority: 1,
  },
];
