Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.user;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.time.LocalDateTime;

/**
 * One answer an agent recorded on the first-call checklist.
 *
 * <p>Unique per (lead, question), so re-opening the checklist updates the answer rather than
 * stacking a second one — the point is what the retailer said, not how many times it was typed.
 *
 * <p>Every answer type lands in the same text column. A checklist is read back as prose, and giving
 * numbers their own column would buy nothing while costing a migration each time a type is added.
 */
@Entity
@Table(name = "user.lead_call_answer",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"lead_id", "question_id"})})
public class LeadCallAnswer {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true, updatable = false)
    private int id;

    @Column(name = "lead_id")
    private int leadId;

    /** The call it was taken on — what makes this a record of the conversation, not a form fill. */
    @Column(name = "lead_call_id")
    private Integer leadCallId;

    @Column(name = "question_id")
    private int questionId;

    @Column(name = "auth_id")
    private int authId;

    @Column(name = "answer")
    private String answer;

    /**
     * Points this answer earned, snapshotted from the question when it was recorded. Stored rather
     * than recomputed so that re-pricing a question later cannot silently rewrite a lead's score.
     */
    @Column(name = "points_awarded")
    private int pointsAwarded;

    @Column(name = "created_timestamp")
    private LocalDateTime createdTimestamp;

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }

    public int getLeadId() { return leadId; }
    public void setLeadId(int leadId) { this.leadId = leadId; }

    public Integer getLeadCallId() { return leadCallId; }
    public void setLeadCallId(Integer leadCallId) { this.leadCallId = leadCallId; }

    public int getQuestionId() { return questionId; }
    public void setQuestionId(int questionId) { this.questionId = questionId; }

    public int getAuthId() { return authId; }
    public void setAuthId(int authId) { this.authId = authId; }

    public String getAnswer() { return answer; }
    public void setAnswer(String answer) { this.answer = answer; }

    public int getPointsAwarded() { return pointsAwarded; }
    public void setPointsAwarded(int pointsAwarded) { this.pointsAwarded = pointsAwarded; }

    public LocalDateTime getCreatedTimestamp() { return createdTimestamp; }
    public void setCreatedTimestamp(LocalDateTime createdTimestamp) { this.createdTimestamp = createdTimestamp; }
}