# Auto Disable

The auto-disable feature automatically deactivates maintenance mode when the timer reaches zero.

### Implementation

```php
// Timer initialization
php artisan curtain:up --timer="2 hours"
```

## How it Works

### Timer Setup

```php
// CurtainService.php
protected function setTimer(string $duration): void
{
    $endTime = Carbon::now()->add($duration);
    Cache::put(self::CACHE_KEY, $endTime);
}
```

### Auto Disable Process

```javascript
// Frontend countdown.blade.php
async update() {
    if (distance < 0) {
        // Timer completed
        clearInterval(this.interval);
        
        try {
            // Call auto-disable endpoint
            const response = await fetch('/curtain/disable');
            if (response.ok) {
                window.location.reload();
            }
        } catch (error) {
            // Retry mechanism
            setTimeout(() => window.location.reload(), 5000);
        }
    }
}
```

### Error Handling

* Automatic retry on failure
* Graceful degradation
* User feedback during process
