import React from "react";
import Button from "./Button";

interface PaginationProps {
    hasNext: boolean;
    nextCursor?: string;
    previousCursor?: string;
    onNext: (cursor?: string) => void;
    onPrevious: (cursor?: string) => void;
}

const Pagination: React.FC<PaginationProps> = ({
    hasNext,
    nextCursor,
    previousCursor,
    onNext,
    onPrevious,
}) => {
    // اگر hasNext فالس باشد، pagination نمایش داده نمی‌شود
    if (!hasNext && !previousCursor) return null;

    return (
        <div className="flex items-center justify-center gap-4 mt-6">
            <Button
                label="قبلی"
                onClick={() => onPrevious(previousCursor)}
                disabled={!previousCursor}
                className="w-fit"
            />

            <Button
                label="بعدی"
                onClick={() => onNext(nextCursor)}
                disabled={!hasNext}
                className="w-fit"
            />


        </div>
    );
};

export default Pagination;