<?php

namespace GriffinForms\Admin\Html\FormControls\Field\ValidationTraits;

trait Imageselection
{
    protected $min_selections;
    protected $max_selections;

    protected function setMinSelections()
    {
        $this->min_selections = $this->fixEmptyValue('min_selections', '');
    }

    protected function setMaxSelections()
    {
        $this->max_selections = $this->fixEmptyValue('max_selections', '');
    }

    private function minSelections()
    {
        $field = new \GriffinForms\Admin\Html\FormControls\InputNumber('min_selections', $this->min_selections);

        echo '<div>' . esc_html__('Minimum Selections', 'griffinforms-form-builder') . '</div>';
        echo '<div class="mb-2">';
        $field->html();
        echo '</div>';
    }

    private function maxSelections()
    {
        $field = new \GriffinForms\Admin\Html\FormControls\InputNumber('max_selections', $this->max_selections);

        echo '<div>' . esc_html__('Maximum Selections', 'griffinforms-form-builder') . '</div>';
        echo '<div>';
        $field->html();
        echo '</div>';
    }

    protected function validationOptionsImageselection()
    {
        echo '<div class="row">';
        echo '<div class="col-md-12 gf-validation-options" id="gf-custom-parameters-wrap">';
        $this->minSelections();
        $this->maxSelections();
        echo '</div>';
        echo '</div>';
    }

    protected function imageselectionJs()
    {
        echo '';
    }
}
