<?php

namespace GriffinForms\Frontend\Security\FieldValidations;

class TermsConditions extends Format
{
    protected function customValidate($value, $iteration_index)
    {
        if ($value === '' || $value === null) {
            return;
        }

        if (!in_array($value, array('1', 1, 'accepted'), true)) {
            $this->addError(__('Invalid confirmation value received for Terms and Conditions.', 'griffinforms-form-builder'), $iteration_index);
        }
    }
}
