'use client'
import { useSafeQuery } from "@/hooks/use-safe-query";
import { getStateAction, getMunicipalityAction, getParishAction } from "../actions/actions";

// Hook for users 
export function useStateQuery() {
    return useSafeQuery(['state'], () => getStateAction())
}

export function useMunicipalityQuery( stateId : number ) { 
    return useSafeQuery(['municipality', stateId], () =>  getMunicipalityAction(stateId))
}

export function useParishQuery(municipalityId : number) { 
    return useSafeQuery(['parish', municipalityId], () =>  getParishAction(municipalityId))
}