"""
PIPE 분류 테스트
"""

from .pipe_classifier import classify_pipe, generate_pipe_cutting_plan

def test_pipe_classification():
    """PIPE 분류 테스트"""
    
    test_cases = [
        {
            "dat_file": "PIP_PE",
            "description": "PIPE, SMLS, SCH 80, ASTM A106 GR B BOE-POE",
            "main_nom": "1\"",
            "length": 798.1965
        },
        {
            "dat_file": "NIP_TR", 
            "description": "NIPPLE, SMLS, SCH 80, ASTM A106 GR B PBE",
            "main_nom": "1\"",
            "length": 75.0
        },
        {
            "dat_file": "PIPE_SPOOL",
            "description": "PIPE SPOOL, WELDED, SCH 40, CS",
            "main_nom": "2\"",
            "length": None
        }
    ]
    
    print("🔧 PIPE 분류 테스트 시작\n")
    
    for i, test in enumerate(test_cases, 1):
        result = classify_pipe(
            test["dat_file"], 
            test["description"], 
            test["main_nom"],
            test["length"]
        )
        
        cutting_plan = generate_pipe_cutting_plan(result)
        
        print(f"테스트 {i}:")
        print(f"  입력: {test['description']}")
        print(f"  재질: {result['material']['standard']} | {result['material']['grade']}")
        print(f"  제조방법: {result['manufacturing']['method']}")
        print(f"  끝가공: {result['end_preparation']['cutting_note']}")
        print(f"  스케줄: {result['schedule']['schedule']}")
        print(f"  절단치수: {result['cutting_dimensions']['length_mm']}mm")
        print(f"  전체신뢰도: {result['overall_confidence']}")
        print(f"  절단지시: {cutting_plan['cutting_instruction']}")
        print()

if __name__ == "__main__":
    test_pipe_classification()
