using System;
using System.Collections.Generic;
using Jovian.PopupSystem.UI;
using UnityEngine;
namespace Jovian.PopupSystem {
///
/// Core interface for the popup system. Created per game state, not as a singleton.
/// Manages category registration, trigger discovery, popup display, and lifecycle.
///
public interface IPopupSystem {
///
/// Scans all components under the given parent and binds them
/// to this system. Each trigger receives a for behavior.
///
void ScanTriggers(Transform parent);
///
/// Scans all components under the given parent, binds them,
/// and invokes the configure callback with both the trigger (for hierarchy queries) and
/// its view (for setting content).
///
void InitializeTriggersInChildren(Transform parent, Action configureTrigger);
///
/// Returns the for the first registered trigger whose
/// GameObject name matches. Returns null if not found.
///
PopupTriggerView GetTriggerHandler(string gameObjectName);
///
/// Returns all instances registered under the given category.
///
IReadOnlyList GetTriggerHandlers(PopupCategory category);
///
/// Registers a popup category. Each category gets its own instance
/// (lazily created on first show) and its own .
///
/// The category to register.
/// Fallback priority if not defined in . Higher dismisses lower.
void RegisterCategory(PopupCategory category, int priority = 0);
///
/// Shows a popup for the given category after the configured delay. The build callback
/// populates content via . Optionally anchors to a
/// RectTransform or follows the mouse if no anchor is provided.
///
void Show(PopupCategory category, Action buildContent,
RectTransform anchor = null, AnchorSide? anchorSide = null);
///
/// Shows a popup for the given category at a fixed screen position.
///
void ShowAtPosition(PopupCategory category, Action buildContent,
Vector2 screenPosition);
///
/// Hides the popup for the given category with a fade-out animation.
///
void Hide(PopupCategory category);
///
/// Hides all visible popups across all categories.
///
void HideAll();
///
/// Drives delay timers, animations, and follow-mouse positioning. Call every frame.
///
void Tick(float deltaTime);
///
/// Destroys all popup view GameObjects and clears registered categories.
/// Call when the owning game state exits.
///
void Dispose();
}
}