package com.flightticket.service;

import com.flightticket.dto.backoffice.*;

import java.util.List;

/**
 * Service for back-office management features including dashboard metrics,
 * manual wallet adjustments, user impersonation, and system configuration.
 * Requirements: 17.1, 17.3, 17.4, 17.5, 17.6
 */
public interface BackOfficeService {
    
    /**
     * Get dashboard metrics for Super_Admin.
     * Includes system health, active users, transaction volumes, and pending actions.
     * Requirements: 17.1, 17.6
     *
     * @return dashboard metrics
     */
    DashboardMetrics getDashboardMetrics();
    
    /**
     * Manually adjust wallet balance with audit trail.
     * Only Super_Admin can perform manual adjustments.
     * Requirements: 17.3
     *
     * @param request the adjustment request
     * @param adjustedBy the ID of the Super_Admin performing the adjustment
     * @return the adjustment response with audit information
     */
    ManualWalletAdjustmentResponse adjustWalletBalance(ManualWalletAdjustmentRequest request, String adjustedBy);
    
    /**
     * Start an impersonation session for a target user.
     * Only Super_Admin can impersonate users.
     * All actions during impersonation are logged with both IDs.
     * Requirements: 17.4
     *
     * @param request the impersonation request
     * @param impersonatingUserId the ID of the Super_Admin starting impersonation
     * @return the impersonation response with session token
     */
    ImpersonationResponse startImpersonation(ImpersonationRequest request, String impersonatingUserId);
    
    /**
     * End an impersonation session.
     * Requirements: 17.4
     *
     * @param sessionId the impersonation session ID
     * @param impersonatingUserId the ID of the Super_Admin ending impersonation
     */
    void endImpersonation(String sessionId, String impersonatingUserId);
    
    /**
     * Get or create a system configuration.
     * Requirements: 17.5
     *
     * @param key the configuration key
     * @return the configuration response
     */
    SystemConfigurationResponse getConfiguration(String key);
    
    /**
     * Get all system configurations, optionally filtered by category.
     * Requirements: 17.5
     *
     * @param category optional category filter
     * @return list of configurations
     */
    List<SystemConfigurationResponse> getAllConfigurations(String category);
    
    /**
     * Update or create a system configuration.
     * Implements configuration versioning.
     * Requirements: 17.5
     *
     * @param request the configuration request
     * @param updatedBy the ID of the user updating the configuration
     * @return the updated configuration response
     */
    SystemConfigurationResponse updateConfiguration(SystemConfigurationRequest request, String updatedBy);
    
    /**
     * Delete a system configuration.
     * Requirements: 17.5
     *
     * @param key the configuration key
     * @param deletedBy the ID of the user deleting the configuration
     */
    void deleteConfiguration(String key, String deletedBy);
}
