package com.flightticket.service;

import com.flightticket.model.entity.Ticket;

import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;

/**
 * Service interface for ticketing operations
 * Requirements: 7.1, 7.2, 7.3, 7.4, 7.6, 9.1, 9.2, 9.4, 9.5
 */
public interface TicketingService {
    
    /**
     * Issue a ticket for a confirmed booking
     * Requirements: 7.1, 7.2, 7.3, 7.4
     * 
     * @param bookingId Booking ID to issue ticket for
     * @param issuedBy User ID issuing the ticket
     * @return Issued ticket
     */
    Ticket issueTicket(UUID bookingId, UUID issuedBy);
    
    /**
     * Void a ticket within the allowed time window
     * Requirements: 9.1, 9.2
     * 
     * @param ticketId Ticket ID to void
     * @param voidedBy User ID voiding the ticket
     * @return Void result with refund details
     */
    VoidResult voidTicket(UUID ticketId, UUID voidedBy);
    
    /**
     * Refund a ticket according to fare rules
     * Requirements: 9.4, 9.5
     * 
     * @param ticketId Ticket ID to refund
     * @param refundedBy User ID requesting refund
     * @return Refund result with refund amount and penalties
     */
    RefundResult refundTicket(UUID ticketId, UUID refundedBy);
    
    /**
     * Get ticket by ID
     * 
     * @param ticketId Ticket ID
     * @return Ticket entity
     */
    Ticket getTicket(UUID ticketId);
    
    /**
     * Get ticket by ticket number
     * 
     * @param ticketNumber Ticket number
     * @return Ticket entity
     */
    Ticket getTicketByNumber(String ticketNumber);
    
    /**
     * Get all tickets for an agency
     * 
     * @param agencyId Agency ID
     * @return List of tickets
     */
    List<Ticket> getTicketsByAgency(UUID agencyId);
    
    /**
     * Get all tickets for a booking
     * 
     * @param bookingId Booking ID
     * @return List of tickets
     */
    List<Ticket> getTicketsByBooking(UUID bookingId);
    
    /**
     * Void result containing void operation details
     */
    interface VoidResult {
        boolean isSuccess();
        UUID getTicketId();
        BigDecimal getRefundedAmount();
        String getMessage();
    }
    
    /**
     * Refund result containing refund operation details
     */
    interface RefundResult {
        boolean isSuccess();
        UUID getTicketId();
        BigDecimal getRefundedAmount();
        BigDecimal getPenaltyAmount();
        String getMessage();
    }
}
