package com.smyhub.infogenie.infogeniebackendjava.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.UpdateTimestamp;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Maps to the site_feature_card_clicks table.
 * Composite primary key: (section, item_id).
 * Tracks how many times each feature card has been clicked per section.
 */
@Data
@NoArgsConstructor
@Entity
@Table(name = "site_feature_card_clicks")
@IdClass(SiteFeatureCardClick.ClickId.class)
public class SiteFeatureCardClick {

    @Id
    @Column(name = "section", length = 50)
    private String section;

    @Id
    @Column(name = "item_id", length = 100)
    private String itemId;

    @Column(name = "click_count")
    private Long clickCount = 0L;

    @UpdateTimestamp
    @Column(name = "updated_at")
    private LocalDateTime updatedAt;

    @Data
    @NoArgsConstructor
    public static class ClickId implements Serializable {
        private String section;
        private String itemId;
    }
}
