Subversion Repositories SmartDukaan

Rev

Rev 37268 | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * Per-SKU hot deal attributes, one row per catalog.
 *
 * <p>This table no longer decides <em>whether</em> a SKU is a hot deal - brand membership
 * does that ({@code catalog.brand = 'Hot Deal'}). What survives here is the data a brand
 * row cannot carry: the five partner-facing pill attributes, which differ per SKU, and
 * {@code oemBrand}, the brand the SKU held before the move.
 */
@Entity
@Table(name = "catalog.model_hot_deal")
public class ModelHotDeal {

    @Id
    @Column
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(name = "catalog_item_id")
    private int catalogItemId;

    /**
     * The brand this SKU carried before it moved to "Hot Deal". Sole source of the Solr
     * field {@code oem_brand_s}, which drives the brand chips inside the hot-deal
     * listing. Set once by the migration; not user-editable.
     *
     * <p>Deliberately kept out of Solr's {@code brand_ss}: that field is multi-valued and
     * feeds {@code SolrService.brandExclusionFq}, so an OEM value there would hide the SKU
     * from a partner blocked on that OEM. Channel and non-channel stock are different
     * brands, so the block must not follow the SKU across the move.
     */
    @Column(name = "oem_brand")
    private String oemBrand;

    /**
     * The same model's catalog entry under its OEM brand, where one exists - the
     * channel-stock counterpart of this non-channel SKU.
     *
     * <p>Optional and never inferred: many hot-deal models have no channel twin, and a
     * wrong mapping is worse than none, so it is set only by an explicit choice in the
     * admin, from an autosuggest scoped to {@link #oemBrand}.
     */
    @Column(name = "oem_catalog_id")
    private Integer oemCatalogId;

    @Column(name = "warranty_months")
    private int warrantyMonths;

    @Column(name = "item_condition")
    @Enumerated(EnumType.STRING)
    private HotDealCondition itemCondition;

    /** true = device unused/sealed ("Fresh"); replaces the old inverted "activated" term. */
    @Column(name = "fresh")
    private boolean fresh;

    @Column(name = "finance_mapping")
    private boolean financeMapping;

    @Column(name = "affordability")
    private boolean affordability;

    @Column(name = "created_on")
    private LocalDateTime createdOn;

    @Column(name = "created_by")
    private String createdBy;

    @Column(name = "modified_on")
    private LocalDateTime modifiedOn;

    @Column(name = "modified_by")
    private String modifiedBy;

    @Transient
    private String catalogDescription;

    public int getId() {
        return id;
    }

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

    public int getCatalogItemId() {
        return catalogItemId;
    }

    public void setCatalogItemId(int catalogItemId) {
        this.catalogItemId = catalogItemId;
    }

    public String getOemBrand() {
        return oemBrand;
    }

    public void setOemBrand(String oemBrand) {
        this.oemBrand = oemBrand;
    }

    public Integer getOemCatalogId() {
        return oemCatalogId;
    }

    public void setOemCatalogId(Integer oemCatalogId) {
        this.oemCatalogId = oemCatalogId;
    }

    /** Description of the mapped OEM model, filled in for the admin table only. */
    @Transient
    private String oemCatalogDescription;

    public String getOemCatalogDescription() {
        return oemCatalogDescription;
    }

    public void setOemCatalogDescription(String oemCatalogDescription) {
        this.oemCatalogDescription = oemCatalogDescription;
    }

    public LocalDateTime getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(LocalDateTime createdOn) {
        this.createdOn = createdOn;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public LocalDateTime getModifiedOn() {
        return modifiedOn;
    }

    public void setModifiedOn(LocalDateTime modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    public String getModifiedBy() {
        return modifiedBy;
    }

    public void setModifiedBy(String modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    public String getCatalogDescription() {
        return catalogDescription;
    }

    public void setCatalogDescription(String catalogDescription) {
        this.catalogDescription = catalogDescription;
    }

    public int getWarrantyMonths() {
        return warrantyMonths;
    }

    public void setWarrantyMonths(int warrantyMonths) {
        this.warrantyMonths = warrantyMonths;
    }

    public HotDealCondition getItemCondition() {
        return itemCondition;
    }

    public void setItemCondition(HotDealCondition itemCondition) {
        this.itemCondition = itemCondition;
    }

    public boolean isFresh() {
        return fresh;
    }

    public void setFresh(boolean fresh) {
        this.fresh = fresh;
    }

    public boolean isFinanceMapping() {
        return financeMapping;
    }

    public void setFinanceMapping(boolean financeMapping) {
        this.financeMapping = financeMapping;
    }

    public boolean isAffordability() {
        return affordability;
    }

    public void setAffordability(boolean affordability) {
        this.affordability = affordability;
    }
}