<?php

declare(strict_types=1);

return [
    // Login form accepts one value and detects it in this order.
    'login_identifiers' => ['email', 'phone', 'username'],
    'identifier_field_name' => 'login',
    'password_field_name' => 'password',

    'username' => [
        'required' => true,
        'min_length' => 3,
        'max_length' => 32,
        'pattern' => '/^[a-z][a-z0-9._]{2,31}$/i',
        'normalize' => 'lowercase',
    ],
    'email' => [
        'required' => false,
        'max_length' => 191,
        'normalize' => 'lowercase',
        'verification_ready' => true,
    ],
    'phone' => [
        'required' => false,
        'format' => 'E.164',
        'pattern' => '/^\+[1-9][0-9]{7,14}$/',
        'verification_ready' => true,
    ],
    'password' => [
        'min_length' => 10,
        'max_length' => 72,
        'algorithm' => PASSWORD_DEFAULT,
        'require_confirmation' => true,
    ],
    'registration' => [
        'require_at_least_one_contact' => true,
        'default_country' => 'GH',
        'default_timezone' => 'Africa/Accra',
        'default_locale' => 'en_GH',
        'minimum_age' => 18,
    ],
    'login_rate_limit' => [
        'attempts' => 5,
        'window_seconds' => 900,
        'lockout_seconds' => 900,
    ],
    'password_reset' => [
        'token_bytes' => 32,
        'expires_minutes' => 30,
        'max_attempts' => 5,
    ],
    'verification' => [
        'email_expires_minutes' => 60,
        'phone_code_digits' => 6,
        'phone_expires_minutes' => 10,
        'max_attempts' => 5,
    ],
];
