package com.flightticket.service;

import com.flightticket.dto.user.CreateUserRequest;
import com.flightticket.dto.user.UpdateUserRequest;
import com.flightticket.dto.user.UserResponse;
import com.flightticket.model.enums.Role;

import java.util.List;
import java.util.UUID;

/**
 * Service for managing users in the B2B flight ticketing platform
 * Requirements: 2.2, 2.3, 2.4
 */
public interface UserManagementService {
    
    /**
     * Create a new user
     * Super Admin can create users for any agency
     * Agency Admin can only create users for their own agency
     * Requirements: 2.2, 2.3
     * 
     * @param request User creation request
     * @param createdBy ID of the user creating this user
     * @return Created user response
     */
    UserResponse createUser(CreateUserRequest request, UUID createdBy);
    
    /**
     * Update an existing user
     * Super Admin can update any user
     * Agency Admin can only update users in their own agency
     * Requirements: 2.2, 2.3, 2.4
     * 
     * @param userId ID of the user to update
     * @param request User update request
     * @return Updated user response
     */
    UserResponse updateUser(UUID userId, UpdateUserRequest request);
    
    /**
     * Delete a user (soft delete by setting status to INACTIVE)
     * Super Admin can delete any user
     * Agency Admin can only delete users in their own agency
     * Requirements: 2.2, 2.3
     * 
     * @param userId ID of the user to delete
     */
    void deleteUser(UUID userId);
    
    /**
     * Get a user by ID
     * Users can only view users from their own agency unless they are Super Admin
     * Requirements: 2.2, 2.3, 3.3
     * 
     * @param userId ID of the user to retrieve
     * @return User response
     */
    UserResponse getUserById(UUID userId);
    
    /**
     * Get all users for a specific agency
     * Super Admin can view users from any agency
     * Other users can only view users from their own agency
     * Requirements: 2.3, 3.3
     * 
     * @param agencyId ID of the agency
     * @return List of users in the agency
     */
    List<UserResponse> getUsersByAgency(UUID agencyId);
    
    /**
     * Assign a role to a user
     * Super Admin can assign any role
     * Agency Admin cannot assign Super Admin role
     * Requirements: 2.2, 2.3, 2.4
     * 
     * @param userId ID of the user
     * @param role Role to assign
     */
    void assignRole(UUID userId, Role role);
    
    /**
     * Revoke a role from a user
     * Super Admin can revoke any role
     * Agency Admin cannot revoke Super Admin role
     * Requirements: 2.2, 2.3, 2.4
     * 
     * @param userId ID of the user
     * @param role Role to revoke
     */
    void revokeRole(UUID userId, Role role);
    
    /**
     * Get all users in the system (Super Admin only)
     * Requirements: 2.2
     * 
     * @return List of all users
     */
    List<UserResponse> getAllUsers();
}
