<?php

namespace WooSwatches\Modules;

use WooSwatches\Base\Module;

final class Product_Page_Settings extends Module {

	public function __construct() {
		parent::__construct();
	}

	public function default_settings() {
		return array(
			'show_selected_attr'         => true,
			'variation_separator'        => ':',
			'generate_variation_url'     => false,
			'attr_display_limit'         => '',
			'more_attribute_style'       => 'more_text',
			'enable_preloader'           => false,
			'enable_thumb_preview_hover' => false
		);
	}

	public function validate_settings( $settings ) {
		$settings['show_selected_attr']         = wp_validate_boolean( $settings['show_selected_attr'] );
		$settings['variation_separator']        = esc_textarea( $settings['variation_separator'] );
		$settings['generate_variation_url']     = wp_validate_boolean( $settings['generate_variation_url'] );
		$settings['attr_display_limit']         = sanitize_text_field( $settings['attr_display_limit'] );
		$settings['more_attribute_style']       = sanitize_key( $settings['more_attribute_style'] );
		$settings['enable_preloader']           = wp_validate_boolean( $settings['enable_preloader'] );
		$settings['enable_thumb_preview_hover'] = wp_validate_boolean( $settings['enable_thumb_preview_hover'] );

		return $settings;
	}
}