<?php
namespace App\Models;

use Core\Model;

class User extends Model
{
    protected static string $table = 'users';
    protected static bool $auditable = true;

    /**
     * Find a user by their email address.
     *
     * @param string $email
     * @return array|false
     */
    public static function findByEmail(string $email)
    {
        return self::where('email', $email);
    }

    /**
     * Get all users by a specific role (e.g., 'customer', 'admin').
     *
     * @param string $role
     * @return array
     */
    public static function getByRole(string $role): array
    {
        return self::whereAll('role', $role);
    }
}