"""SK150201 몽타주 확인"""
import json
from pathlib import Path

# 최신 출력 디렉토리
result_base = Path(__file__).parent.parent.parent / "분석결과"
v2_dirs = sorted([d for d in result_base.iterdir() if d.is_dir() and d.name.endswith('_v2')],
                 key=lambda d: d.stat().st_mtime)
latest_dir = v2_dirs[-1]

with open(latest_dir / 'intermediate_data.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

clad = data['clad']

# SK150201 찾기
skills = [s for s in clad['defaultSkills'] if s and s.get('skillId') == 'SK150201']
if not skills:
    print("SK150201을 찾을 수 없습니다.")
    exit(1)

skill = skills[0]
print(f"SK150201: {skill.get('name')}")
print(f"useMontages: {skill.get('useMontages')}\n")

montage_data = skill.get('montageData', [])
print(f"montageData: {len(montage_data)}개\n")

for idx, md in enumerate(montage_data):
    print(f"[{idx}] {md.get('assetName')}")
    print(f"  hasAttack: {md.get('hasAttack')}")
    print(f"  attackNotifies: {len(md.get('attackNotifies', []))}개")
    print(f"  allNotifies: {len(md.get('allNotifies', []))}개")

    # allNotifies에서 SimpleSendEvent 찾기
    all_notifies = md.get('allNotifies', [])
    for notify in all_notifies:
        notify_class = notify.get('NotifyClass', '')
        if 'SimpleSendEvent' in notify_class:
            custom_props = notify.get('CustomProperties', {})
            event_tag = custom_props.get('Event Tag', '')
            print(f"    SimpleSendEvent found: {event_tag}")
    print()
