package com.ruoyi.ccdi.project.service;

import java.util.Arrays;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;

class CcdiProjectOverviewServiceStructureTest {

    @Test
    void shouldExposeOverviewServiceMethods() throws Exception {
        Class<?> clazz = Class.forName("com.ruoyi.ccdi.project.service.ICcdiProjectOverviewService");

        assertNotNull(clazz.getMethod("getDashboard", Long.class));
        assertNotNull(clazz.getMethod(
            "getRiskPeopleOverview",
            Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO")
        ));
        assertNotNull(clazz.getMethod("getTopRiskPeople", Long.class));
        assertNotNull(clazz.getMethod(
            "getPersonAnalysisDetail",
            Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectPersonAnalysisDetailQueryDTO")
        ));
        assertNotNull(clazz.getMethod(
            "getSuspiciousTransactions",
            Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO")
        ));
        assertNotNull(clazz.getMethod(
            "getEmployeeCreditNegative",
            Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO")
        ));
        assertNotNull(clazz.getMethod(
            "exportSuspiciousTransactions",
            Class.forName("com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO")
        ));
        assertNotNull(clazz.getMethod("refreshOverviewEmployeeResults", Long.class, String.class));
        assertNotNull(clazz.getMethod("refreshProjectRiskCounts", Long.class, String.class));
    }

    @Test
    void overviewServiceImplShouldNotDependOnModelParamService() throws Exception {
        Class<?> clazz = Class.forName(
            "com.ruoyi.ccdi.project.service.impl.CcdiProjectOverviewServiceImpl"
        );

        assertFalse(Arrays.stream(clazz.getDeclaredFields()).anyMatch(field ->
            "com.ruoyi.ccdi.project.service.ICcdiModelParamService".equals(field.getType().getName())
        ));
    }
}
