<?php
/**
 * Memorable temporary passwords: color + fruit/vegetable (e.g. redpepper, blueonion).
 */

/** @return list<string> */
function nazareth_memorable_password_colors(): array
{
    return [
        'red', 'blue', 'green', 'gold', 'black', 'pink', 'brown', 'gray', 'grey',
        'purple', 'yellow', 'silver', 'amber', 'lime', 'teal', 'navy', 'coral',
        'ivory', 'crimson', 'maroon', 'violet', 'indigo', 'bronze', 'copper',
    ];
}

/** @return list<string> */
function nazareth_memorable_password_foods(): array
{
    return [
        'pepper', 'onion', 'mango', 'okra', 'yam', 'plantain', 'coconut', 'grape',
        'melon', 'carrot', 'tomato', 'banana', 'guava', 'cassava', 'cabbage',
        'lettuce', 'potato', 'garlic', 'ginger', 'corn', 'beans', 'pea', 'apple',
        'pear', 'plum', 'peach', 'lemon', 'lime', 'spinach', 'beet', 'radish',
        'pumpkin', 'squash', 'cucumber', 'avocado', 'papaya', 'pineapple', 'cherry',
    ];
}

/**
 * One word: lowercase color + food (e.g. redpepper).
 */
function nazareth_generate_memorable_password(): string
{
    $colors = nazareth_memorable_password_colors();
    $foods = nazareth_memorable_password_foods();
    return $colors[random_int(0, count($colors) - 1)] . $foods[random_int(0, count($foods) - 1)];
}
