<?php

namespace HelpGent\App\DTO;

defined( 'ABSPATH' ) || exit;

use HelpGent\WpMVC\DTO\DTO;

class AdminEntryReadDTO extends DTO {
    private int $form_id = 0;

    private int $per_page = 20;

    private int $page = 1;

    private string $search = '';

    private string $status = 'all';

    private string $date_type = 'all';

    private array $date_frame = [];

    private string $sort_by = 'submitted_on';

    private string $sort_order = 'desc';

    public function get_form_id(): int {
        return $this->form_id;
    }

    public function set_form_id( int $form_id ): self {
        $this->form_id = $form_id;

        return $this;
    }

    public function get_per_page(): int {
        return $this->per_page;
    }

    public function set_per_page( int $per_page ): self {
        $this->per_page = $per_page > 0 ? $per_page : 20;

        return $this;
    }

    public function get_page(): int {
        return $this->page;
    }

    public function set_page( int $page ): self {
        $this->page = $page > 0 ? $page : 1;

        return $this;
    }

    public function get_search(): string {
        return $this->search;
    }

    public function set_search( string $search ): self {
        $this->search = $search;

        return $this;
    }

    public function get_status(): string {
        return $this->status;
    }

    public function set_status( string $status ): self {
        $this->status = $status;

        return $this;
    }

    public function get_date_type(): string {
        return $this->date_type;
    }

    public function set_date_type( string $date_type ): self {
        $this->date_type = $date_type;

        return $this;
    }

    public function get_date_frame(): array {
        return $this->date_frame;
    }

    public function set_date_frame( array $date_frame ): self {
        $this->date_frame = $date_frame;

        return $this;
    }

    public function get_sort_by(): string {
        return $this->sort_by;
    }

    public function set_sort_by( string $sort_by ): self {
        $this->sort_by = $sort_by;

        return $this;
    }

    public function get_sort_order(): string {
        return $this->sort_order;
    }

    public function set_sort_order( string $sort_order ): self {
        $this->sort_order = 'asc' === strtolower( $sort_order ) ? 'asc' : 'desc';

        return $this;
    }
}
