<?php #CodeGenerator V3 Δ 888f3d68415880e6c8925b038f0014c9 Δ DYNAMICALLY GENERATED FILE - Do not modify this line! Remove it completely to protect the file from changes.
/**
 * Form Request Class
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @version     STUB: 1.0.0
 * @generated   2026-04-14 17:09:33
 * @package     bplan-base/globals
 * @subpackage  FormRequests
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Http\Requests;


use BplanBase\Globals\Enums\ImportStatus;
use BplanBase\Globals\Traits\FormRequestKeyPrefix;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;


/**
 * Form Request Class
 *
 * @version     1.0.0 / 2026-04-14
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class UpdateImportLogRecordRequest extends FormRequest
{


/* +++ TRAITS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


    use FormRequestKeyPrefix;


/* +++ CLASS CONSTANTS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT MEMBERS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * @var     null|string
     */
    protected null|string $_prefix;


    /**
     * @var     int|string|null
     */
    protected int|string|null $_recordId;


/* +++ CLASS MEMBERS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT METHODS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * Get the ID
     *
     * @return      int|string|null
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    protected function _resolveRecordId(): int|string|null
    {
        if ($this->_recordId !== null) {
            return $this->_recordId;
        }
        /*
            Implement the logic to get the ID out of the request.
        return $this->route('user') ?? $this->input('id');
        */
        return null;

    } // _resolveRecordId()


    /**
     * Determine if the user is authorized to make this request
     *
     * @return      bool
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function authorize(): bool
    {
        return true;

    } // authorize()


    /**
     * Get the validation rules that apply to the request
     *
     * @return      array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function rules(): array
    {
        $recordId = $this->_resolveRecordId();

        $rules = [
            'failures'      => [],
            'import_log_id' => ['sometimes', 'required', 'integer'],
            'row_data'      => [],
            'status'        => ['required', Rule::enum(ImportStatus::class)],

        ];
        if ($this->_prefix === null) {
            return $rules;
        }
        return $this->_prependValidationRuleKeys($rules, $this->_prefix);

    } // rules()


/* +++ CLASS METHODS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * Set the ID and get the validation rules that apply to the request
     *
     * @param       int|string $recordId
     *
     * @param       null|string $prefix
     *
     * @return      array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     *
     * @version     1.0.0 / 2026-04-14
     * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public static function getRules(int|string $recordId, null|string $prefix = null): array
    {
        $Instance = new static();

        $Instance->_recordId = $recordId;
        $Instance->_prefix = $prefix;

        return $Instance->rules();

    } // getRules()


} // class UpdateImportLogRecordRequest extends FormRequest {}
