package src.fr.impl.Parts;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import src.fr.api.PartType;
import src.fr.impl.PartImpl;




public class Interior extends PartImpl { 
     
     private static final HashMap<String,Integer> prices;
     static {
          prices = new HashMap<>();
          prices.put("IN",0);
          prices.put("IH",800);
          prices.put("IS",2500);
      }

     private static final Set<String> colorSet;
     static {
          colorSet = new HashSet<>();
          colorSet.add("black");
          colorSet.add("white");
          colorSet.add("cream");
     }

     String color;


     public Interior(){
          this.addProperty("color", () -> getColor(), c -> setColor(c), colorSet);
          this.setProperty("color","black");

     }

     public String getColor(){
          return this.color;
     }

     public void setColor(String newColor){
          this.color = newColor;
     }

     @Override
     public void setType(PartType type){
          this.type = type;
          if(prices.containsKey(type.getName())){
               this.price = prices.get(type.getName());
          }
          else this.price = 0;
    }

}
