<?php
	namespace Juju\PDO;

	class DefaultValue {
		private static $defaults = [];
		private $name;
		private $default;
		private function __construct(string $name, string $default){
			$this->name = $name;
			$this->default = $default;
			self::$defaults[$name] = $this;
		}
		public function __toString(){
			return $this->default;
		}
		public static function named(string $name){
			if(!isset(self::$defaults[$name])){
				throw new \Exception("DefaultValue {$name} not defined");
			}
			return self::$defaults[$name];
		}
		public static function add(string $name, string $default){
			if(isset(self::$defaults[$name])){
				throw new \Exception("DefaultValue {$name} already defined");
			}
			return new DefaultValue($name, $default);
		}
	}
	DefaultValue::add('current_timestamp', 'current_timestamp');
?>