<?php

namespace Modules\Payroll\DTO;

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

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