<?php

declare(strict_types=1);

namespace mirzaev\arming_bot\models\enumerations;

/**
 * Types of human languages
 *
 * @package mirzaev\arming_bot\models\enumerations
 *
 * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
 * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
 */
enum language
{
	case en;
	case ru;

	/**
	 * Translate label of language
	 *
	 * @param language|null $language Language into which to translate
	 *
	 * @return string Translated label of language
   *
	 * @todo
	 * 1. More languages
	 * 2. Cases???
	 */
	public function translate(?language $language = language::en): string
	{
		// Exit (success)
		return match ($this) {
			language::en =>	match ($language) {
				language::en => 'English',
				language::ru => 'Английский'
			},
			language::ru => match ($language) {
				language::en => 'Russian',
				language::ru => 'Русский'
			}
		};
	}
}
