package cn.momia.service.deal.web.ctrl.dto;

import cn.momia.api.product.sku.Sku;
import cn.momia.service.deal.order.Order;
import cn.momia.api.product.Product;
import cn.momia.service.base.web.ctrl.dto.Dto;

import java.math.BigDecimal;
import java.util.List;

public class OrderDetailDto extends OrderDto implements Dto {
    private Product product;

    public String getCover() {
        return product.getCover();
    }

    public String getTitle() {
        return product.getTitle();
    }

    public String getScheduler() {
        return product.getScheduler();
    }

    // TODO
//    public String getRegion() {
//        return MetaUtil.getRegionName(product.getRegionId());
//    }

    public String getAddress() {
        return product.getAddress();
    }

    public BigDecimal getPrice() {
        return product.getPrice();
    }

    public String getTime() {
        return product.getSkuTime(getSkuId());
    }

    public boolean isClosed() {
        List<Sku> skus = product.getSkus();
        if (skus == null || skus.isEmpty()) return true;
        for (Sku sku : skus) {
            if (sku.getSkuId() == getSkuId()) return sku.isClosed();
        }

        return true;
    }

    public OrderDetailDto(Order order, Product product) {
        super(order);
        this.product = product;
    }
}

@@ -578,22 +578,8 @@
  %7D%0A%0A
-    // TODO%0A//
     
@@ -581,30 +581,27 @@
 %0A    public 
-Str
 in
-g
+t
  getRegion()
@@ -602,15 +602,15 @@
 gion
+Id
 () %7B%0A
-//
     
@@ -624,31 +624,8 @@
 urn 
-MetaUtil.getRegionName(
 prod
@@ -645,13 +645,10 @@
 Id()
-)
 ;%0A
-//
     

return regionid