package jsbook.chapter6.marketplace;

import net.jini.core.entry.Entry;

public class BidEntry implements Entry {
    public String label;
    public Integer idNum;
    public String participant;
    public Integer year;
    public String make;
    public String model;
    public String exteriorColor;
    public String interiorColor;      
    public Integer price;

    public BidEntry() {
    }
                
    public BidEntry(String label, Integer idNum, 
        String participant, Integer year, 
        String make, String model,
        String exteriorColor, String interiorColor, Integer price)
    {
        this.label = label;
        this.idNum = idNum;
        this.participant = participant;
        this.year = year;
        this.make = make;
        this.model = model;
        this.exteriorColor = exteriorColor;
        this.interiorColor = interiorColor;      
        this.price = price;
    }
        
    public String print() {
        String text = "";
        String newline = System.getProperty("line.separator");
        
        text += "ID: " + idNum.toString() + newline + 
                make + " " + model + " " + year.toString();
        if (exteriorColor.length() > 0) {
            text += " " + exteriorColor + "/";
        } else {
            text += " NA/";
        }        
        if (interiorColor.length() > 0) {
            text += interiorColor;
        } else {
            text += "NA";
        }
        
        text += newline + "$" + price.toString() + 
                " from: " + participant + newline; 
        return text;
    }
}
