package kz.cafe.db.model;

import java.text.*;
import java.util.*;
import kz.cafe.constants.*;
import kz.cafe.constants.InterfaceConstants.*;
import kz.cafe.db.model.anotations.*;
import com.google.code.morphia.annotations.*;



@Entity(value="Order", noClassnameStored=true, concern = "SAFE")
public class MOrder extends MAbstractEditableDataElement{
   private static final long serialVersionUID = 1284785145792132969L;
   
   
   @AnnotationNotExported
   public static final String F_UID       = "UID";
   @AnnotationNotExported
   public static final String F_STATUS    = "status";
   @AnnotationNotExported
   public static final String F_PRICE     = "price";


   
   
   @AnnotationRelated(foreign = MCafe.class)
   public int CID;
   
   @AnnotationRelated(foreign = MUser.class)
   public int UID;
   
   @AnnotationRelated(foreign = MSale.class)
   public Integer AID;
   
   
   @AnnotationMultiLangString   
   public Map<InterfaceConstants.LANGS, String> comment = new HashMap<LANGS, String>();
   
   
//   public int price_draft;
//   public int price_final;

   
   public int status = 0;
   
   
   public boolean confirmed; 
   
   public boolean closed;

   @AnnotationPrice
   public int price;
   
   @AnnotationRelated(foreign = MCity.class)
   public Integer deliveryCity;
   
   public String deliveryStreet;
   public String deliveryBuilding;
   public String deliveryApartment;
   public String deliveryPhone;
   
   
   public String humanReadable(InterfaceConstants.LANGS lang){
      SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY HH:mm"); 
      return "Заказ N " + ID + " от " + sdf.format(new Date(super.created));
   }
}
 


