/*
 * 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.apc.controller.system.user;

import com.arrebol.apc.model.catalog.RouteCtlg;
import com.arrebol.apc.model.core.HumanResource;
import com.arrebol.apc.model.core.Office;
import com.arrebol.apc.model.core.UserByOffice;
import com.arrebol.apc.model.enums.HumanResourceStatus;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

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

    private UserCreateController controller;
    private String USER_DIRECTOR = "DireCCioNa";
    private String CEO = "ejecutivo";
    private String USER_GLD_JANITZIO = "5751074e-7d1b-11ea-af3e-28f659da398e";
    private String OFFICE_TEPIC = "caef3a64-7d1f-11ea-af3e-28f659da398e";
    private String OFFICE_GDL = "e0f1a2fc-7d1f-11ea-af3e-28f659da398e";

    @Before
    public void init() {
        controller = new UserCreateController();
    }

    @Test
    public void isUsernameAvailableController() {
        try {
            assertTrue(controller.isUsernameAvailableController(USER_DIRECTOR, OFFICE_GDL));
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    @Test
    public void findAllHRsWithoutUser() {
        try {
            List<HumanResource> result = controller.findAllHRsWithoutUser(new Office(OFFICE_GDL), HumanResourceStatus.ENEBLED);

            result.forEach(System.out::println);

            assertFalse(result.isEmpty());
        } catch (Exception e) {
            assertFalse(true);
        }
    }

    @Test
    public void findIdOfUserByOffice() {
        try {
            UserByOffice userByOffice = controller.findIdOfUserByOffice(USER_GLD_JANITZIO, OFFICE_GDL);

            System.out.println(userByOffice);

            assertNotNull(userByOffice);
        } catch (Exception e) {
            assertFalse(true);
        }
    }
    
    @Test
    public void findRoutesByOffice() {
        try {
            List<RouteCtlg> result = controller.findRoutesByOffice(OFFICE_GDL);

            result.forEach(System.out::println);

            assertFalse(result.isEmpty());
        } catch (Exception e) {
            assertFalse(true);
        }
    }
    
    @Test
    public void findRoutesWithNoCertifierUser() {
        try {
            List<RouteCtlg> result = controller.findRoutesWithNoCertifierUser(OFFICE_TEPIC);

            result.forEach(System.out::println);

            assertTrue(result.isEmpty());
        } catch (Exception e) {
            assertFalse(true);
        }
    }

}
