<?php

namespace Modules\Billing\DTO;

use Illuminate\Http\Request;

class BillingSettingFilter
{
    public function __construct(
        public readonly ?string $search,
        public readonly ?string $status,
        public readonly ?int $perPage = 15,
    ) {}

    public static function fromRequest(Request $request): self
    {
        return new self(
            search: $request->filled('search') ? trim($request->search) : null,
            status: $request->filled('status') ? $request->status : null,
            perPage: $request->filled('per_page') ? (int) $request->per_page : 15,
        );
    }
}
