<?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 ContextualSextaPush extends BasePushNotification
{
    public function label(): string
    {
        return 'cliente_contextual_sexta';
    }

    public function title(): string
    {
        return 'Sexta chegando';
    }

    public function body(): string
    {
        return 'Que tal deixar a casa pronta pro fim de semana?';
    }

    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 sexta-feira */
    public function eligibleUsers(): Collection
    {
        if (! now()->isFriday()) {
            return new Collection;
        }

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