<?php
/**
 * Settings color model.
 *
 * @package northmill-online-shared
 */

declare( strict_types = 1 );

namespace Northmill_Online_Shared\Modules\Admin\Pages\Page\Admin_Sync_Settings\Models\Properties;

defined( 'ABSPATH' ) || exit;

/**
 * Class Settings_Color_Model
 */
class Settings_Color_Model {
	/**
	 * Color (for example #FFFFFF).
	 *
	 * @var string
	 */
	public string $color;

	/**
	 * Settings_Color_Model constructor.
	 *
	 * @param string $color Color (for example #FFFFFF).
	 *
	 * @used Northmill Express.
	 */
	public function __construct( string $color ) {
		$this->color = $color;
	}

	/**
	 * Get color.
	 *
	 * @param bool $keep_hash Keep hash.
	 *
	 * @return string Color (for example #FFFFFF).
	 */
	public function get_color( bool $keep_hash = true ): string {
		return ( $keep_hash )
			? $this->color
			: str_replace( '#', '', $this->color );
	}
}
