package com.mx.dla.dda.reporte.amortizacion.dtos;

import java.util.List;

import com.mx.dla.global.dtos.BaseDTO;

import lombok.Data;

@Data
public class MesesAmortizacionDTO extends BaseDTO {

	private static final long serialVersionUID = 1L;

	private Long idContrato;
	private String descripcion;
	private Double mes1;
	private Double mes2;
	private Double mes3;
	private Double mes4;
	private Double mes5;
	private Double mes6;
	private Double mes7;
	private Double mes8;
	private Double mes9;
	private Double mes10;
	private Double mes11;
	private Double mes12;
	private Double acumulado;
	private Double acumuladoAnt;
	private Double acumuladoSig;
	private Double remanente;
	private String temporada;
	private String sistema;
	private String numContrato;
	
	private List<Integer> anos; //usado solo para pruebas
		
	public MesesAmortizacionDTO(){}
			
	public MesesAmortizacionDTO(Double mes1, Double mes2, Double mes3,
			Double mes4, Double mes5, Double mes6, Double mes7, Double mes8,
			Double mes9, Double mes10, Double mes11, Double mes12) {	
		this.mes1 = mes1;
		this.mes2 = mes2;
		this.mes3 = mes3;
		this.mes4 = mes4;
		this.mes5 = mes5;
		this.mes6 = mes6;
		this.mes7 = mes7;
		this.mes8 = mes8;
		this.mes9 = mes9;
		this.mes10 = mes10;
		this.mes11 = mes11;
		this.mes12 = mes12;
	}
	
	public MesesAmortizacionDTO(Double value) {	
		this.mes1 = value;
		this.mes2 = value;
		this.mes3 = value;
		this.mes4 = value;
		this.mes5 = value;
		this.mes6 = value;
		this.mes7 = value;
		this.mes8 = value;
		this.mes9 = value;
		this.mes10 = value;
		this.mes11 = value;
		this.mes12 = value;
		this.acumulado = value;
		this.acumuladoAnt = value;
		this.acumuladoSig = value;
	}
	
	public void calculaRemanente(Integer month) {
		Double r1 = this.acumuladoAnt; 
		Double r2 = this.acumuladoSig;
		if(month >= 1) {
			r1 += mes1;
		} else {
			r2 += mes1;
		}
		if(month >= 2) {
			r1 += mes2;
		} else {
			r2 += mes2;
		}
		if(month >= 3) {
			r1 += mes3;
		} else {
			r2 += mes3;
		}
		if(month >= 4) {
			r1 += mes4;
		} else {
			r2 += mes4;
		}
		if(month >= 4) {
			r1 += mes4;
		} else {
			r2 += mes4;
		}
		if(month >= 5) {
			r1 += mes5;
		} else {
			r2 += mes5;
		}
		if(month >= 6) {
			r1 += mes6;
		} else {
			r2 += mes6;
		}
		if(month >= 7) {
			r1 += mes7;
		} else {
			r2 += mes7;
		}
		if(month >= 8) {
			r1 += mes8;
		} else {
			r2 += mes8;
		}
		if(month >= 9) {
			r1 += mes9;
		} else {
			r2 += mes9;
		}
		if(month >= 10) {
			r1 += mes10;
		} else {
			r2 += mes10;
		}
		if(month >= 11) {
			r1 += mes11;
		} else {
			r2 += mes11;
		}
		if(month >= 12) {
			r1 += mes12;
		} else {
			r2 += mes12;
		}
		remanente = r1 - r2;
	}

}
