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

import com.arrebol.taxiservicios.model.admin.StableGeneralBox;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.enums.BasicType;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
import org.junit.Test;
import org.junit.Before;

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

    private Date startDate;
    private Date endDate;
    private Date dateToFind;
    private StableGeneralBoxController controller;
    private User user;

    public StableGeneralBoxControllerTest() {
    }

    @Before
    public void setUp() {
        controller = new StableGeneralBoxController();
        Calendar start = Calendar.getInstance();
        Calendar end = Calendar.getInstance();
        Calendar date = Calendar.getInstance();

        //2019-03-07 09:07:04
        start.set(2021, 2, 13, 9, 7, 4);
        //2019-03-07 21:07:04
        end.set(2021, 2, 13, 21, 7, 4);
        date.set(2021, 2, 14, 9, 7, 4);
        startDate = start.getTime();
        endDate = end.getTime();
        dateToFind = date.getTime();
        user = new User("09ea84b8-b9d1-4a71-adfe-db653b2a9982", "");
    }

    //@Test
    public void findExpenseCompanyBetweenDatesIn() {
        try {
            if (controller.existStableGeneralBoxEqToDate(dateToFind, "")) {
                System.out.println("Fecha encontrada");
            } else {
                System.out.println("Fecha NO encontrada");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //@Test
    public void saveStableGeneralBox() {
        try {
            StableGeneralBox stableGeneralBox = new StableGeneralBox(
                    UUID.randomUUID().toString(),
                    BigDecimal.ZERO,
                    BigDecimal.ZERO,
                    BigDecimal.ZERO,
                    BigDecimal.ZERO,
                    endDate);

            stableGeneralBox.setTotalStable(BigDecimal.ZERO);
            stableGeneralBox.setActiveStatus(BasicType.ENEBLED);
            stableGeneralBox.setCreatedBy(user);
            if (controller.saveStableGeneralBox(stableGeneralBox)) {

            } else {

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Test
    public void getTotalInBox() {
        try {
            BigDecimal total = controller.getTotalInBox("");

            System.out.println("Total in general box = " + total);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
