package com.ruoyi.info.collection.service;

import com.ruoyi.info.collection.domain.dto.CcdiAssetInfoDTO;
import com.ruoyi.info.collection.domain.excel.CcdiAssetInfoExcel;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

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

class CcdiAssetInfoDesignContractTest {

    @Test
    void aggregateSaveDto_shouldNotExposePersonId() {
        Set<String> fieldNames = Arrays.stream(CcdiAssetInfoDTO.class.getDeclaredFields())
                .map(field -> field.getName())
                .collect(Collectors.toSet());

        assertFalse(fieldNames.contains("personId"));
    }

    @Test
    void importExcel_shouldStillExposePersonIdForRelationCertNoMatching() {
        Set<String> fieldNames = Arrays.stream(CcdiAssetInfoExcel.class.getDeclaredFields())
                .map(field -> field.getName())
                .collect(Collectors.toSet());

        assertTrue(fieldNames.contains("personId"));
    }
}
