/*
 * Arrebol Consultancy copyright.
 *
 * This code belongs to Arrebol Consultancy
 * its use, redistribution or modification are prohibited
 * without written authorization from Arrebol Consultancy.
 */
package com.arrebol.taxiservicios.model.admin;

import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.ExpenseType;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 *
 * @author Carlos Janitzio Zavala Lopez <janitzio.zavala@arrebol.com.mx>
 */
public class ClosingDayDetail implements Serializable {

   private String id;
   private ClosingDay closingDay;
   private String type;
   private BigDecimal amount;
   private BigDecimal amountSaving;
   private BigDecimal amountAccident;
   private Person person;
   private String comments;
   private User createdBy;
   private Date createdOn;
   private User lastUpdatedBy;
   private Date lastUpdatedOn;

   private GeneralPublic general;

   public ClosingDayDetail() {
   }

   /**
    *
    * @param type
    * @param amount
    * @param amountSaving
    * @param amountAccident
    * @param person
    * @param comments
    */
   public ClosingDayDetail(String type, BigDecimal amount, BigDecimal amountSaving, BigDecimal amountAccident, Person person, String comments) {
      this.type = type;
      this.amount = amount;
      this.amountSaving = amountSaving;
      this.amountAccident = amountAccident;
      this.person = person;
      this.comments = comments;
   }

   /**
    *
    * @param queryNumber 1: query_details_sales, 2: query_details_sanctions_in,
    * 3: query_details_sanctions_out, 4: query_details_expenses, 5:
    * query_details_invoices.
    * @param array
    */
   //Para poder añadir que se va a mostrar (supongo)
   public ClosingDayDetail(int queryNumber, Object[] array) {
      switch (queryNumber) {

         case 1:
            this.type = ExpenseType.valueOf(array[1].toString()).getType();
            this.person = new Person((String) array[2], (String) array[4]);
            this.amount = new BigDecimal((Double) array[0]);
            this.comments = (String) array[3];
            break;
         case 2:
            this.type = array[1].toString();
            this.person = new Person((String) array[2], (String) array[4]);
            this.amount = new BigDecimal((Double) array[0]);
            this.comments = (String) array[3];
            break;
         case 3:
            this.type = array[1].toString();
            this.person = new Person((String) array[2], (String) array[4]);
            this.amount = new BigDecimal((Double) array[0]);
            this.comments = "Folio del pago : " + array[3];
            break;
         case 4:
            this.type = array[1].toString();
            this.person = new Person((String) array[2], (String) array[4]);
            this.amount = new BigDecimal((Double) array[0] * -1);
            this.comments = "Devolución : " + array[3];
            break;
         case 5:
            this.type = array[1].toString();
            this.person = new Person((String) array[2], (String) array[4]);
            this.amount = new BigDecimal((Double) array[0] * -1);
            this.comments = "Primas no devengadas : " + array[3];
            break;
      }

   }

   public String getId() {
      return id;
   }

   public void setId(String id) {
      this.id = id;
   }

   public ClosingDay getClosingDay() {
      return closingDay;
   }

   public void setClosingDay(ClosingDay closingDay) {
      this.closingDay = closingDay;
   }

   public String getType() {
      return type;
   }

   public void setType(String type) {
      this.type = type;
   }

   public BigDecimal getAmount() {
      return amount;
   }

   public void setAmount(BigDecimal amount) {
      this.amount = amount;
   }

   public BigDecimal getAmountSaving() {
      return amountSaving;
   }

   public void setAmountSaving(BigDecimal amountSaving) {
      this.amountSaving = amountSaving;
   }

   public BigDecimal getAmountAccident() {
      return amountAccident;
   }

   public void setAmountAccident(BigDecimal amountAccident) {
      this.amountAccident = amountAccident;
   }

   public Person getPerson() {
      return person;
   }

   public void setPerson(Person person) {
      this.person = person;
   }

   public String getComments() {
      return comments;
   }

   public void setComments(String comments) {
      this.comments = comments;
   }

   public User getCreatedBy() {
      return createdBy;
   }

   public void setCreatedBy(User createdBy) {
      this.createdBy = createdBy;
   }

   public Date getCreatedOn() {
      return createdOn;
   }

   public void setCreatedOn(Date createdOn) {
      this.createdOn = createdOn;
   }

   public User getLastUpdatedBy() {
      return lastUpdatedBy;
   }

   public void setLastUpdatedBy(User lastUpdatedBy) {
      this.lastUpdatedBy = lastUpdatedBy;
   }

   public Date getLastUpdatedOn() {
      return lastUpdatedOn;
   }

   public void setLastUpdatedOn(Date lastUpdatedOn) {
      this.lastUpdatedOn = lastUpdatedOn;
   }

   public GeneralPublic getGeneral() {
      return general;
   }

   public void setGeneral(GeneralPublic general) {
      this.general = general;
   }

   @Override
   public String toString() {
      return "ClosingDayDetail{" + "closingDay=" + closingDay + ", type=" + type + ", comments=" + comments + '}';
   }

}
