package com.alterdekim.game.repository;

import com.alterdekim.game.entity.HouseLocation;
import com.alterdekim.game.entity.Location;
import com.alterdekim.game.entity.LocationObjectInstance;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

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

@Repository
public interface LocationRepository extends JpaRepository<Location, Long> {

    @Query(value = "SELECT l FROM Location l WHERE l.locationId = :uid AND l.isEnabled = true")
    Optional<Location> findLocationById(@Param("uid") Long locationId);

    @Query(value = "SELECT l FROM Location l WHERE l.isEnabled = true AND l.isDefault = true")
    Optional<Location> findDefaultLocation();
}
