<?php

declare(strict_types=1);

namespace prj\mockup\inputs\app;

use \tts\safer_io as SafeIO;
use \tts\INPUTS;
use \tts\FIELD_FILTER;
use \tts\HTML_FLAG;

class home_in {

    public static function name_demo(): array {
        $safer_data = SafeIO::sanitize([
            'first_name' =>
                [
                    'input' => INPUTS::post, // Others: post, json (REQUIRED param)
                    'field' => FIELD_FILTER::raw_string, // Others: raw, (DEFAULT: string), email, url, float, int
                    'html' => HTML_FLAG::purify, // Others: strip, encode, purify, (DEFAULT: escape)
                    'rule' => 'required|max: 75' // Others: email, valid_email_domain, 
                    // min, max, between, same, secure (password), alphanumeric
                ],
            'last_name' =>
                [
                    'input' => INPUTS::post,
                    'field' => FIELD_FILTER::raw_string,
                    'html' => HTML_FLAG::purify,
                    'rule' => 'required|max: 75',
                    'skip_db' => false
                ],
            'age' =>
                [
                    'input' => INPUTS::post,
                    'field' => FIELD_FILTER::integer_number,
                    'rule' => 'greater_than: 18', //'number_range: 18, 24'
                    'message' => ['greater_than' => 'The %s must be an Adult over %d!'],
                ],
        ]);
        
        return $safer_data; // Makes an Array of: fields, html, and errrors
    }

}