/*
 * 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.mutual;

import 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 com.arrebol.taxiservicios.model.enums.MutualAddType;
import com.arrebol.taxiservicios.model.enums.MutualOutType;
import com.arrebol.taxiservicios.model.enums.SanctionType;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

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

    private String id;
    private MutualClosingDay closingDay;
    private String type;
    private BigDecimal amount;
    private Person person;
    private String comments;
    private User createdBy;
    private Date createdOn;
    private User lastUpdatedBy;
    private Date lastUpdatedOn;
    
    private GeneralPublic general;

    public MutualClosingDayDetail() {
    }

    /**
     *
     * @param type
     * @param amount
     * @param amountSaving
     * @param amountAccident
     * @param person
     * @param comments
     */
    public MutualClosingDayDetail(String type, BigDecimal amount, Person person, String comments) {
        this.type = type;
        this.amount = amount;
        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
     */
    public MutualClosingDayDetail(int queryNumber, Object[] array) {
        switch (queryNumber) {
            case 1:
                this.type = "Transferencia Mutual recibida";
                this.person =  new Person((String)array[1],(String) array[3]);
                this.amount = new BigDecimal((Double)array[0]);
                this.comments = "Recibida de usuario: " + (String)array[3];
                break;
            case 2:
                this.type = MutualAddType.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 3:
                this.type = MutualOutType.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 4:
                this.type = "Inicios";
                this.person = new Person((String)array[1], (String)array[3]);
                this.amount = new BigDecimal(array[0].toString());
                this.comments = (String)array[2];
                break;
        }

    }

    public String getId() {
        return id;
    }

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

    public MutualClosingDay getClosingDay() {
        return closingDay;
    }

    public void setClosingDay(MutualClosingDay 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 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 "MutualClosingDayDetail{" + "closingDay=" + closingDay + ", type=" + type + ", comments=" + comments + '}';
    }

}
