package com.ttstd.signaling.model;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.time.Instant;

/**
 * 骚扰举报：被控端对某个主控端账号发起的举报记录（P2 风控）。
 */
@Entity
@Table(name = "abuse_report")
public class AbuseReport {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "device_uid", length = 48, nullable = false)
    private String deviceUid;

    @Column(name = "reported_user_id", length = 48, nullable = false)
    private String reportedUserId;

    @Column(name = "reason", length = 255)
    private String reason;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", length = 16, nullable = false)
    private ReportStatus status = ReportStatus.PENDING;

    @Column(name = "created_at", nullable = false)
    private Instant createdAt = Instant.now();

    protected AbuseReport() {
    }

    public AbuseReport(String deviceUid, String reportedUserId, String reason) {
        this.deviceUid = deviceUid;
        this.reportedUserId = reportedUserId;
        this.reason = reason;
        this.status = ReportStatus.PENDING;
        this.createdAt = Instant.now();
    }

    public Long getId() { return id; }
    public String getDeviceUid() { return deviceUid; }
    public String getReportedUserId() { return reportedUserId; }
    public String getReason() { return reason; }
    public ReportStatus getStatus() { return status; }
    public void setStatus(ReportStatus status) { this.status = status; }
    public Instant getCreatedAt() { return createdAt; }

    public enum ReportStatus { PENDING, HANDLED, DISMISSED }
}
