package com.infinite.focus.server.auth;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface SchoolRepository extends JpaRepository<School, Long> {

	@Query(value = "SELECT * FROM school WHERE account_id = ?1 ", nativeQuery = true)
	School findByAccountId(Long account_id);

	// Find schools by district
	@Query(value = "SELECT * FROM school WHERE district_id = ?1 ORDER BY school_name", nativeQuery = true)
	List<School> findByDistrictId(Long district_id);

	// Find performance profile by registration code
	@Query(value = "SELECT * FROM school WHERE registration_code = ?1", nativeQuery = true)
	School findByRegistrationCode(String registration_code);

	@Query(value = "SELECT * FROM school WHERE license_key = ?1", nativeQuery = true)
	List<School> findByLicenseKey(String license_key);
}