package com.flightticket.service;

import com.flightticket.dto.modification.EligibilityResult;
import com.flightticket.dto.modification.ModificationFees;
import com.flightticket.dto.modification.Restriction;
import com.flightticket.model.entity.Booking;
import com.flightticket.model.enums.ModificationType;

import java.util.List;

/**
 * Service for validating booking modification eligibility.
 * 
 * Requirements: 1.2, 1.5, 9.1, 9.2, 9.3, 9.4
 */
public interface EligibilityService {
    
    /**
     * Check if a booking is eligible for modification.
     * 
     * This method performs comprehensive eligibility checks including:
     * - Booking status validation (must be CONFIRMED)
     * - Departure time validation (not departed, not within 24 hours)
     * - Fare rules validation (fare class allows modifications)
     * 
     * @param booking The booking to check
     * @return Complete eligibility result with allowed modifications and restrictions
     * 
     * Requirements: 1.2, 1.5, 9.1, 9.2, 9.3, 9.4
     * Property 1: Eligibility Determination Consistency
     * Property 2: Eligibility Response Completeness
     * Property 3: Non-Modifiable Booking Handling
     */
    EligibilityResult checkEligibility(Booking booking);
    
    /**
     * Check if a specific modification type is allowed for a booking.
     * 
     * This method validates:
     * - General eligibility (status, time, etc.)
     * - Specific modification type against fare class restrictions
     * 
     * @param booking The booking to check
     * @param type The modification type to validate
     * @return true if the modification type is allowed, false otherwise
     * 
     * Requirements: 9.4
     * Property 7: Fare Rule Compliance
     */
    boolean isModifiable(Booking booking, ModificationType type);
    
    /**
     * Get all restrictions that apply to a booking.
     * 
     * Restrictions may include:
     * - Time limits (24-hour rule, departure status)
     * - Fare class restrictions
     * - Booking status restrictions
     * 
     * @param booking The booking to check
     * @return List of applicable restrictions
     * 
     * Requirements: 1.3, 9.1, 9.2, 9.3, 9.4
     */
    List<Restriction> getRestrictions(Booking booking);
    
    /**
     * Check if a booking is within the time limit for modifications.
     * 
     * A booking is within the time limit if:
     * - The flight has not departed
     * - The departure is more than 24 hours away
     * 
     * @param booking The booking to check
     * @return true if within time limit, false otherwise
     * 
     * Requirements: 9.2, 9.3
     * Property 6: Time Restriction Enforcement
     */
    boolean isWithinTimeLimit(Booking booking);
    
    /**
     * Get estimated modification fees for all modification types.
     * 
     * @param booking The booking to get fees for
     * @return Estimated fees for each modification type
     * 
     * Requirements: 1.3
     */
    ModificationFees getModificationFees(Booking booking);
}
