from __future__ import annotations


# Routing policy remains Omni-first where the scaffold has the strongest synchronized contract.
# That means multi-shot text/image scenes still route to Omni instead of a provisional non-Omni path.
def choose_endpoint(scene: dict) -> str:
    scene_type = scene.get('scene_type')
    if scene.get('extend_flag'):
        return 'extend'
    if scene_type == 'continuity':
        return 'reference2video'
    if scene_type == 'image_single':
        return 'image2video'
    if scene_type == 'image_multi_shot':
        return 'omni'
    if scene_type == 'text_single':
        return 'text2video'
    if scene_type == 'text_multi_shot':
        return 'omni'
    if scene_type == 'omni':
        return 'omni'
    if scene_type == 'text':
        return 'text2video'
    if scene_type == 'image_ref':
        return 'image2video'
    raise ValueError(f'Unknown scene_type: {scene_type}')
