<?php

namespace App\Http\Requests\Messaging;

use App\Http\Requests\ApiFormRequest;

class MessageSendRequest extends ApiFormRequest
{
    public function rules(): array
    {
        return [
            'recipient_id' => ['nullable', 'integer', 'min:1', 'required_without:recipient_role'],
            'recipient_role' => ['nullable', 'string', 'required_without:recipient_id', 'in:teacher,parent,admin,student,guest,administrator'],
            'subject' => ['required', 'string', 'max:255'],
            'message' => ['required', 'string'],
            'priority' => ['nullable', 'in:low,normal,high'],
            'status' => ['nullable', 'in:sent,received,draft,trashed'],
            'semester' => ['nullable', 'string', 'max:255'],
            'school_year' => ['nullable', 'string', 'max:20'],
            'attachment' => ['nullable', 'file', 'max:10240'],
        ];
    }
}
