<?php
/**
 * Currency class.
 *
 * @package DokanKits\Admin\Dashboard\Components\Fields
 * @since   3.0.0
 */

namespace DokanKits\Admin\Dashboard\Components\Fields;

/**
 * Currency field class.
 *
 * Extends the Text field to provide currency-specific functionality.
 *
 * @since 3.0.0
 * @package DokanKits\Admin\Dashboard\Components\Fields
 */
class Currency extends Text {

	/**
	 * Input Type.
	 *
	 * @var string $input_type Input Type.
	 */
	protected string $input_type = 'currency';

	/**
	 * Currency symbol.
	 *
	 * @var string $currency_symbol Currency symbol.
	 */
	protected string $currency_symbol;

	/**
	 * Populate features array.
	 *
	 * @return array
	 */
	public function populate(): array {
		$data                    = parent::populate();
		$data['default']         = $this->get_default();
		$data['placeholder']     = $this->get_placeholder();
		$data['readonly']        = $this->is_readonly();
		$data['disabled']        = $this->is_disabled();
		$data['currency_symbol'] = $this->get_currency_symbol();

		return $data;
	}

	/**
	 * Get currency symbol.
	 *
	 * @return string
	 */
	public function get_currency_symbol(): ?string {
		return $this->currency_symbol;
	}

	/**
	 * Set currency symbol.
	 *
	 * @param string $currency_symbol Currency symbol.
	 *
	 * @return Currency
	 */
	public function set_currency_symbol( string $currency_symbol ): Currency {
		$this->currency_symbol = $currency_symbol;

		return $this;
	}
}
