<?php

namespace LaraBB\User\UI\Web\Requests\Register;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\RedirectResponse;

/**
 * Class Store
 * @package LaraBB\User\UI\Web\Requests\Register
 */
class Store extends FormRequest
{
    /**
     * @var string
     */
    protected $redirectRoute = 'register-index';

    /**
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * @return string[]
     */
    public function rules(): array
    {
        return [];
    }

    /**
     * @return array
     */
    public function messages(): array
    {
        return [];
    }

    /**
     * @return RedirectResponse
     */
    public function success(): RedirectResponse
    {
        return redirect()->route('register-page', ['#step3']);
    }

    /**
     * @return RedirectResponse
     */
    public function failed(): RedirectResponse
    {
        return redirect()->route('register-page', ['#step2']);
    }

    /**
     * @return string
     */
    public function getRedirectUrl(): string
    {
        return parent::getRedirectUrl() . '#step-2';
    }
}
