<?php

namespace Modules\Activity\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Modules\Activity\Entities\Activity;

class UploadActivityDocumentRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'type' => [
                'nullable',
                'string',
                'max:255',
                Rule::notIn([Activity::GALLERY_DOCUMENT_TYPE]),
            ],
            'description' => 'nullable|string|max:1000',
            'file' => 'required|file|mimes:pdf,jpg,jpeg,png,doc,docx|max:10240',
        ];
    }

    public function messages(): array
    {
        return [
            'type.not_in' => 'Imej galeri mesti dimuat naik melalui endpoint galeri aktiviti.',
            'file.required' => 'Fail diperlukan.',
            'file.mimes' => 'Format fail tidak disokong.',
            'file.max' => 'Saiz fail melebihi had maksimum 10MB.',
        ];
    }
}
