```python
def invoice_total(lines: list[dict], rate: int) -> dict[str, int]:
    if not lines:
        raise ValueError("No invoice lines provided")
    
    for line in lines:
        qty = line.get('qty')
        unit = line.get('unit')
        discount = line.get('discount')
        
        if not isinstance(qty, int) or qty <= 0:
            raise ValueError("Quantity must be a positive integer")
        if not isinstance(unit, int) or unit < 0:
            raise ValueError("Unit price must be a non-negative integer")
        if not (isinstance(discount, int) and 0 <= discount <= 10000):
            raise ValueError("Discount rate must be an integer between 0 and 10000")
    
    subtotal = sum(
        (line['qty'] * line['unit']) - round((line['qty'] * line['unit']) * line['discount'] / 10000)
        for line in lines
    )
    
    tax = round(subtotal * rate / 10000)
    total = subtotal + tax
    
    return {'subtotal': subtotal, 'tax': tax, 'total': total}
```