package com.example.computers.repository;

import com.example.computers.entity.Manufacturer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;

public interface ManufacturerRepository extends JpaRepository<Manufacturer, Long> {
    @Query("SELECT m FROM Manufacturer m WHERE " +
            "LOWER(m.name) LIKE LOWER(CONCAT('%', :q, '%')) OR " +
            "LOWER(m.country) LIKE LOWER(CONCAT('%', :q, '%'))")
    List<Manufacturer> search(@Param("q") String query);
}