```python
"""The cheapest set of travel passes covering every trip day."""


def _validate_plan(trip_days, passes):
    for day in trip_days:
        if isinstance(day, bool) or not isinstance(day, int) or day < 1:
            raise ValueError("trip days must be positive integers")
    for earlier, later in zip(trip_days, trip_days[1:]):
        if later <= earlier:
            raise ValueError("trip days must be strictly increasing")
    if not passes:
        raise ValueError("at least one pass kind is required")
    for cover in passes:
        span = cover["span"]
        cost = cover["cost"]
        if isinstance(span, bool) or not isinstance(span, int) or span < 1:
            raise ValueError("pass span must be a positive integer")
        if isinstance(cost, bool) or not isinstance(cost, int) or cost < 0:
            raise ValueError("pass cost must be a non-negative integer")


def cheapest_pass_plan(trip_days: list, passes: list) -> dict:
    _validate_plan(trip_days, passes)
    
    # Sort passes by cost and then by span
    passes.sort(key=lambda x: (x["cost"], x["span"]))
    
    # Initialize variables
    total_cost = 0
    purchases = []
    current_day = 0
    
    # Iterate over each trip day
    for day in trip_days:
        # Find the cheapest pass that covers the current day
        for pass_kind in passes:
            if day <= current_day + pass_kind["span"] - 1:
                total_cost += pass_kind["cost"]
                purchases.append((current_day, pass_kind["span"]))
                current_day += pass_kind["span"]
                break
    
    # If all days were covered, return the result
    if current_day >= max(trip_days):
        return {"total": total_cost, "purchases": purchases}
    else:
        raise ValueError("not enough passes to cover all trip days")
```