package com.foxx.androidcast.display;

/**
 * Developer-only preference for which display MediaProjection should target once
 * multi-display capture is implemented (roadmap D).
 */
public enum ExternalDisplayCapturePolicy {
    /** Current production behavior: default display only. */
    DEFAULT_DISPLAY_ONLY,
    /**
     * When an external display is connected, prefer capturing it (not implemented —
     * falls back to default until wired capture lands).
     */
    PREFER_EXTERNAL_WHEN_PRESENT,
    /**
     * Explicit secondary-display capture (future; requires API 34+ rules review).
     */
    EXTERNAL_DISPLAY_EXPERIMENTAL;

    public static ExternalDisplayCapturePolicy fromName(String name, ExternalDisplayCapturePolicy fallback) {
        if (name == null || name.isEmpty()) {
            return fallback;
        }
        try {
            return valueOf(name);
        } catch (IllegalArgumentException e) {
            return fallback;
        }
    }

    /** Human-readable status for developer settings. */
    public String implementationNote() {
        switch (this) {
            case PREFER_EXTERNAL_WHEN_PRESENT:
                return "Planned: auto-route capture to HDMI when present (not active).";
            case EXTERNAL_DISPLAY_EXPERIMENTAL:
                return "Planned: explicit secondary-display VirtualDisplay (not active).";
            case DEFAULT_DISPLAY_ONLY:
            default:
                return "Active: captures the default display (standard cast).";
        }
    }
}
