import{isEmpty as t}from"lodash-es";const e=()=>({City:{state:async(t,e,{stateDataLoader:i})=>t?.state?.name?t.state:i.load(t.state.toString())},Query:{async cities(e,i,{cityService:a,countryService:r,stateService:c}){const{countryOptions:n,cityOptions:o,stateOptions:s}=i?.input||{};let y,l;if(!t(n)){const t=await r.getAll({criteria:n});y=t?.map((t=>t.id))}if(!t(s)||y?.length){const{criteria:t,...e}=s||{},i=await c.getAll({criteria:{...t,...y?.length&&{country:{$in:y}},...e}});l=i?.map((({id:t})=>t))}const{criteria:p,...d}=o||{},u={...p,...{...l?.length&&{state:{$in:l}}}},g={...d,criteria:u};return{data:await a.getAll({criteria:u}),totalCount:await a.count(g)}},city:(t,{id:e},{cityService:i},a)=>i.get(e)},Mutation:{createCity:(t,{propertyCity:e},{cityService:i})=>i.create(e),updateCity:(t,{id:e,propertyCity:i},{cityService:a})=>a.update(e,i,!1),deleteCity:(t,{id:e},{cityService:i})=>i.delete(e)}});export{e as cityResolvers};