"use client";

import React from "react";
import Image from "next/image";
// import styles from "./ModelCard.module.css";
import styles from "./ModelCard.module.css"
import { Models } from "./ThreeModelView";

export interface ModelCardProps {
  model:Models;
  // isSelected?: boolean;
  onSelect?: () => void
}

const ModelCard: React.FC<ModelCardProps> = ({
  model,
  onSelect
}) => {
  const { title, description, image, category, program,  tag } = model;
  return (
    <div className={styles.card}>
      <div className={styles.imageWrapper}>
        <Image src={`/images/${image}`} alt={title} className={styles.image} width={250} height={300} />

        <span className={styles.badge}>📦 3D Model</span>

        <div className={styles.overlay}  onClick={onSelect}>
          <button className={styles.viewButton}>👁 View Model</button>
        </div>
      </div>

      <div className={styles.content}>
        <h3 className={`${styles.title} ${styles.truncate}`}>{title}</h3>
        <p className={`${styles.description} ${styles.truncate}`}>{description}</p>

        <div className={styles.metaRow}>
          <span>📖 {category}</span>
          <span>🎓 {program}</span>
        </div>

        {tag && <span className={styles.tag}>{tag}</span>}

        {/* <div className={styles.footer}>
          <span>{size}</span>
          <span>📅 {date}</span>
        </div> */}
      </div>
    </div>
  );
};

export default ModelCard;
