<?php

namespace GriffinForms\Frontend\Html\Alerts;

class Field extends \GriffinForms\Frontend\Html\Alerts\Format
{
    protected function fieldAlertTag($class = 'griffinforms-alert')
    {
        echo '<span class="' . esc_attr($class) . ' alert alert-danger p-1 small rounded-0 me-1 mb-2" role="alert" style="display:none;">';
    }
    
    public function isPattern()
    {
        $this->fieldAlertTag('griffinforms-alert-ispattern');
        echo wp_kses_post($this->lang->getText('is_pattern'));
        echo '</span>';
    }
    
    public function isRequired()
    {
        $this->fieldAlertTag('griffinforms-alert-isrequired');
        echo wp_kses_post($this->lang->getText('is_required'));
        echo '</span>';
    }
    
    public function isNumber()
    {
        $this->fieldAlertTag('griffinforms-alert-isnumber');
        echo wp_kses_post($this->lang->getText('is_number'));
        echo '</span>';
    }
    
    public function invalidMin($min)
    {
        $this->fieldAlertTag('griffinforms-alert-invalidmin');
        echo wp_kses_post($this->lang->getText('invalid_min_no', array('min' => $min)));
        echo '</span>';
    }
    
    public function invalidMax($max)
    {
        $this->fieldAlertTag('griffinforms-alert-invalidmax');
        echo wp_kses_post($this->lang->getText('invalid_max_no', array('max' => $max)));
        echo '</span>';
    }
    
    public function invalidOddNo()
    {
        $this->fieldAlertTag('griffinforms-alert-invalidoddno');
        echo wp_kses_post($this->lang->getText('invalid_odd_no'));
        echo '</span>';
    }
    
    public function invalidEvenNo()
    {
        $this->fieldAlertTag('griffinforms-alert-invalidevenno');
        echo wp_kses_post($this->lang->getText('invalid_even_no'));
        echo '</span>';
    }
    
    public function floatNotAllowed()
    {
        $this->fieldAlertTag('griffinforms-alert-floatnotallowed');
        echo wp_kses_post($this->lang->getText('float_not_allowed'));
        echo '</span>';
    }
}