import { useState } from "react";
import type { FilterValues } from "@/components/Filters";

const DEFAULT_PAGE = 1;
const DEFAULT_LIMIT = 10;

export const useCouponFilters = () => {
  const [filters, setFilters] = useState<FilterValues>({});
  const [currentPage, setCurrentPage] = useState(DEFAULT_PAGE);
  const [limit] = useState(DEFAULT_LIMIT);

  const handleFiltersChange = (newFilters: FilterValues) => {
    setFilters(newFilters);
    setCurrentPage(DEFAULT_PAGE);
  };

  const handlePageChange = (page: number) => {
    setCurrentPage(page);
  };

  return {
    filters,
    currentPage,
    handleFiltersChange,
    handlePageChange,
    limit,
  };
};
