<?php

namespace App\Http\Requests;


use Illuminate\Validation\Rule;

class MakePaymentRequest extends ApiBaseRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            "package_id"=>"required|integer",
            "first_name"=>"required|string",
            "last_name"=>"required|string",
            'email'=>['required', 'email'],
            'password'=>'required|min:8|regex:'.$this->password_validation_rule,
            'birth_date'=>'required|date_format:m/d/Y|before:18 years ago|after:-150 years',
            'full_ssn'=>'required',
            'street_no'=>'required|string|regex:'.$this->script_validation_rule,
            'street_name'=>'required|regex:'.$this->script_validation_rule,
            'city'=>'required|string|regex:'.$this->script_validation_rule,
            'state'=>'required|string|regex:'.$this->script_validation_rule,
            'zip_code'=>'required|string|regex:'.$this->script_validation_rule,
            'ssn'=>'required',
            'phone'=>'required|string|regex:'.$this->script_validation_rule,
            'amount'=>'required|numeric',
            'card_number'=>'required|regex:/^\d{15,20}$/',
            'expiry'=>['required','string','regex:'.$this->RULE_EXPIRY_REGEX]
        ];
    }


    public function messages()
    {
        return [
            'card_number.regex'=>'Value is invalid'
        ];
    }
}
