package com.example.backend.orders.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.example.backend.orders.model.OrderEntity;

public interface OrderRepository
        extends CrudRepository<OrderEntity, Long>, PagingAndSortingRepository<OrderEntity, Long> {
    Optional<OrderEntity> findOneByUserIdAndId(long userId, long id);

    List<OrderEntity> findByUserId(long userId);

    Page<OrderEntity> findByUserId(long userId, Pageable pageable);
}
