package com.bonus.canteen.core.order.deprecated.vo;

import com.bonus.canteen.core.order.common.model.OrderDetail;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

public class OrdMacDtlVO implements Serializable {
   @ApiModelProperty("明细id")
   private Long detailId;
   @ApiModelProperty(
      value = "订单id",
      hidden = true
   )
   private Long orderId;
   @ApiModelProperty("商品名称")
   private String goodsName;
   @ApiModelProperty("商品单价 单位为分")
   private Integer price;
   @ApiModelProperty("数量")
   private Integer quantity;

   public static OrdMacDtlVO of(OrderDetail orderDetail) {
      OrdMacDtlVO ordMacDtlVO = new OrdMacDtlVO();
      ordMacDtlVO.setDetailId(orderDetail.getDetailId());
      ordMacDtlVO.setOrderId(orderDetail.getOrderId());
      ordMacDtlVO.setGoodsName(orderDetail.getGoodsDishesName());
      ordMacDtlVO.setPrice(orderDetail.getPrice() != null ? orderDetail.getPrice().intValue() : 0);
      ordMacDtlVO.setQuantity(orderDetail.getQuantity());
      return ordMacDtlVO;
   }

   public Long getDetailId() {
      return this.detailId;
   }

   public Long getOrderId() {
      return this.orderId;
   }

   public String getGoodsName() {
      return this.goodsName;
   }

   public Integer getPrice() {
      return this.price;
   }

   public Integer getQuantity() {
      return this.quantity;
   }

   public void setDetailId(final Long detailId) {
      this.detailId = detailId;
   }

   public void setOrderId(final Long orderId) {
      this.orderId = orderId;
   }

   public void setGoodsName(final String goodsName) {
      this.goodsName = goodsName;
   }

   public void setPrice(final Integer price) {
      this.price = price;
   }

   public void setQuantity(final Integer quantity) {
      this.quantity = quantity;
   }

}
