<?php

namespace App\Notifications\Push\Cliente\Contextual;

use App\Enums\PushNotificationCategoryEnum;
use App\Enums\PushNotificationTargetEnum;
use App\Models\User;
use App\Notifications\Push\BasePushNotification;
use Illuminate\Database\Eloquent\Collection;

class ContextualSegundaPush extends BasePushNotification
{
    public function label(): string
    {
        return 'cliente_contextual_segunda';
    }

    public function title(): string
    {
        return 'Segunda organizada';
    }

    public function body(): string
    {
        return 'Comece a semana com a casa limpa.';
    }

    public function target(): PushNotificationTargetEnum
    {
        return PushNotificationTargetEnum::CLIENTE;
    }

    public function category(): PushNotificationCategoryEnum
    {
        return PushNotificationCategoryEnum::CONTEXTUAL;
    }

    public function notificationCooldownDays(): int
    {
        return 7;
    }

    public function categoryCooldownDays(): int
    {
        return 7;
    }

    /** Só retorna usuários se hoje for segunda-feira */
    public function eligibleUsers(): Collection
    {
        if (! now()->isMonday()) {
            return new Collection;
        }

        return User::whereHas('client')
            ->where('registration_complete', true)
            ->get();
    }
}
