using LocationTrackerApp.Models;

namespace LocationTrackerApp.Services;

/// <summary>
/// Interface for location tracking service
/// </summary>
public interface ILocationService
{
    /// <summary>
    /// Event fired when a new location is received
    /// </summary>
    event EventHandler<LocationData>? LocationChanged;

    /// <summary>
    /// Event fired when location tracking status changes
    /// </summary>
    event EventHandler<bool>? TrackingStatusChanged;

    /// <summary>
    /// Gets the current location tracking status
    /// </summary>
    bool IsTracking { get; }

    /// <summary>
    /// Gets the current session ID
    /// </summary>
    string? CurrentSessionId { get; }

    /// <summary>
    /// Starts location tracking
    /// </summary>
    /// <param name="sessionId">Optional session ID for grouping location data</param>
    /// <returns>Task representing the async operation</returns>
    Task StartTrackingAsync(string? sessionId = null);

    /// <summary>
    /// Stops location tracking
    /// </summary>
    /// <returns>Task representing the async operation</returns>
    Task StopTrackingAsync();

    /// <summary>
    /// Gets the current location
    /// </summary>
    /// <returns>Current location data or null if not available</returns>
    Task<LocationData?> GetCurrentLocationAsync();

    /// <summary>
    /// Requests location permissions from the user
    /// </summary>
    /// <returns>True if permissions are granted, false otherwise</returns>
    Task<bool> RequestLocationPermissionsAsync();

    /// <summary>
    /// Checks if location permissions are granted
    /// </summary>
    /// <returns>True if permissions are granted, false otherwise</returns>
    Task<bool> HasLocationPermissionsAsync();
}
