Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

package com.spice.profitmandi.service.lms.meta;

import com.spice.profitmandi.dao.enumuration.dtr.MetaLeadOutcome;

/**
 * One evaluated row of a Meta export: what it would become, and what will actually happen to it.
 *
 * <p>Produced identically by preview and by commit, so what the user approves on screen is exactly
 * what gets written. A preview that runs different logic from the commit is worse than no preview.
 */
public class MetaLeadRow {

    /** 1-based line number in the spreadsheet, header included — what the user sees in Excel. */
    public int rowNumber;

    public String metaLeadId;
    public String name;
    public String mobile;
    public String outletName;
    public String city;
    public String state;
    public String email;
    public double potential;
    /** The business-value band exactly as answered, kept because the number above is lossy. */
    public String businessValueBand;

    public Integer regionId;
    public String regionCode;
    public String regionName;

    public String campaignName;
    public String formName;
    public String platform;
    public String metaCreatedTime;

    /** Verbatim answers to the form's qualifying questions, for the trail. */
    public String qualifiers;

    /**
     * Set when text had to be changed to fit the latin1 columns of {@code user.lead} — names the
     * fields affected so the preview can show it rather than silently mangling a retailer's name.
     */
    public String sanitisedNote;

    public MetaLeadOutcome outcome;
    public String reason;

    /** Set on DUPLICATE (the lead already present) and on CREATED (the lead just made). */
    public Integer leadId;

    /** Raw row as JSON, stored so a mapping bug can be replayed. */
    public String rawJson;

    /**
     * This Meta lead already has a {@code user.meta_lead} row from an earlier upload, so the commit
     * must not write a second one — {@code meta_lead_id} is unique, and inserting again fails the
     * whole import. One Meta lead id, one audit row, ever.
     */
    public boolean alreadyRecorded;

    /** The Call Center agent this lead will be given to. Null when imported unassigned. */
    public Integer assignedToAuthId;

    public boolean willCreate() {
        return outcome == MetaLeadOutcome.CREATED;
    }
}