<?php

namespace App\Notifications\Push\Cliente\Recorrencia;

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

class Recorrencia1Push extends BasePushNotification
{
    public function label(): string
    {
        return 'cliente_recorrencia_1';
    }

    public function title(): string
    {
        return 'Hora da próxima diária?';
    }

    public function body(): string
    {
        return 'Faz um tempo desde sua última limpeza 😊';
    }

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

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

    public function eligibleUsers(): Collection
    {
        return User::whereHas('client.schedules', fn ($q) => $q->where('status', 'finished'))
            ->whereDoesntHave('client.schedules', fn ($q) => $q->where('status', 'finished')
                ->where('updated_at', '>=', now()->subDays(30)))
            ->get();
    }
}
