<?php

    namespace Modules\Lpj\Http\Requests;

    use Illuminate\Foundation\Http\FormRequest;

    class DokumenJaminanRequest extends FormRequest
    {
        /**
         * Get the validation rules that apply to the request.
         */
        public function rules()
        : array
        {
            $rules = [
                'debiture_id'        => 'required|exists:debitures,id',
                'permohonan_id'      => 'required|exists:permohonan,id',
                'pemilik_jaminan_id' => 'required',
                'jenis_jaminan_id'   => 'required',
                'province_code'      => 'nullable|exists:provinces,code',
                'city_code'          => 'nullable|exists:cities,code',
                'district_code'      => 'nullable|exists:districts,code',
                'village_code'       => 'nullable|exists:villages,code',
                'address'            => 'nullable|string',
                'postal_code'        => 'nullable|string|max:10',
                'status'             => 'nullable|boolean',
            ];

            return $rules;
        }

        /**
         * Determine if the user is authorized to make this request.
         */
        public function authorize()
        : bool
        {
            return true;
        }
    }
