package com.bonus.canteen.core.order.android.dto;

import cn.hutool.core.collection.CollUtil;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

public class OrderDishesUpdateAndroidDTO {
   private Long orderId;
   private List<Long> orderIds;
   private @NotNull Integer dishesState;
   private List<OrderDishesUpdateDTO.DetailDishesMakeCompleteDTO> detailDishesMakeList;

   public @NotNull @Size(
   min = 1
) List<Long> getOrderIds() {
      return (List)(CollUtil.isEmpty(this.orderIds) && this.orderId != null ? CollUtil.toList(new Long[]{this.orderId}) : this.orderIds);
   }

   public OrderDishesUpdateDTO toSingleUpdateDTO() {
      OrderDishesUpdateDTO orderDishesUpdateDTO = OrderDishesUpdateDTO.of(CollUtil.isNotEmpty(this.getOrderIds()) ? (Long)this.getOrderIds().get(0) : this.orderId, this.dishesState);
      orderDishesUpdateDTO.setDetailDishesMakeList(this.detailDishesMakeList);
      return orderDishesUpdateDTO;
   }

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

   public Integer getDishesState() {
      return this.dishesState;
   }

   public List<OrderDishesUpdateDTO.DetailDishesMakeCompleteDTO> getDetailDishesMakeList() {
      return this.detailDishesMakeList;
   }

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

   public void setOrderIds(final List<Long> orderIds) {
      this.orderIds = orderIds;
   }

   public void setDishesState(final Integer dishesState) {
      this.dishesState = dishesState;
   }

   public void setDetailDishesMakeList(final List<OrderDishesUpdateDTO.DetailDishesMakeCompleteDTO> detailDishesMakeList) {
      this.detailDishesMakeList = detailDishesMakeList;
   }

}
