<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'name'            => 'required|string|max:150',
            'type'            => 'required|in:supplier,customer,both',
            'phone'           => 'required|string|max:20',
            'email'           => 'nullable|email|max:100',
            'address'         => 'nullable|string|max:255',
            'city'            => 'nullable|string|max:50',
            'country'         => 'nullable|string|max:50',
            'opening_balance' => 'nullable|numeric|min:0',
            'balance_type'    => 'nullable|in:debit,credit',
            'credit_limit'    => 'nullable|numeric|min:0',
            'notes'           => 'nullable|string|max:500',
            'is_active'       => 'nullable|boolean',
        ];
    }
}
