package com.cf.imes.module.system.enums.config;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

/**
 * {@link SystemConfigTypeEnum} 的单元测试
 */
public class SystemConfigTypeEnumTest {

    @Test
    public void testEnumValues() {
        // 测试枚举值是否正确
        assertEquals(1, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType());
        assertEquals("自定义板编号", SystemConfigTypeEnum.CUSTOM_PLATE_NO.getName());

        assertEquals(2, SystemConfigTypeEnum.INTELLIGENT_BRANCH.getType());
        assertEquals("板件筛选", SystemConfigTypeEnum.INTELLIGENT_BRANCH.getName());

        assertEquals(3, SystemConfigTypeEnum.PROCESSING_SCREENING.getType());
        assertEquals("加工筛选", SystemConfigTypeEnum.PROCESSING_SCREENING.getName());

        assertEquals(4, SystemConfigTypeEnum.DATA_PROCESSING.getType());
        assertEquals("数据处理", SystemConfigTypeEnum.DATA_PROCESSING.getName());

        assertEquals(5, SystemConfigTypeEnum.PROCESS_SCHEME.getType());
        assertEquals("加工方案组", SystemConfigTypeEnum.PROCESS_SCHEME.getName());

        assertEquals(6, SystemConfigTypeEnum.SEALEDGE.getType());
        assertEquals("封边条对应", SystemConfigTypeEnum.SEALEDGE.getName());
    }

    @Test
    public void testFromType() {
        // 测试 fromType 方法
        assertEquals(SystemConfigTypeEnum.CUSTOM_PLATE_NO, SystemConfigTypeEnum.fromType(1));
        assertEquals(SystemConfigTypeEnum.INTELLIGENT_BRANCH, SystemConfigTypeEnum.fromType(2));
        assertEquals(SystemConfigTypeEnum.PROCESSING_SCREENING, SystemConfigTypeEnum.fromType(3));
        assertEquals(SystemConfigTypeEnum.DATA_PROCESSING, SystemConfigTypeEnum.fromType(4));
        assertEquals(SystemConfigTypeEnum.PROCESS_SCHEME, SystemConfigTypeEnum.fromType(5));
        assertEquals(SystemConfigTypeEnum.SEALEDGE, SystemConfigTypeEnum.fromType(6));
        assertNull(SystemConfigTypeEnum.fromType(99)); // 不存在的类型
        assertNull(SystemConfigTypeEnum.fromType(null)); // null值
    }
}