import{a7 as y,a4 as s,h as f,p,a as c,aT as m,aQ as d}from"./index-dNe6i2rS.js";import{s as l}from"./sortBy-COer1Ia5.js";import{m as $}from"./mergeRight-D1nsCm60.js";import{b as u}from"./time-utils-CQYZ5msB.js";const T=y.injectEndpoints({endpoints:g=>({getFgMonitoringConfigByEntity:g.query({query:({pId:t,fsId:r,fgId:e,modelName:o,modelVersion:n})=>{const i=`
            project/${t}/
            featurestores/${r}/
            featuregroups/${e}/
            featuremonitoring/config/entity/
          `.replace(/\s/g,"");return{url:o!==void 0&&n!==void 0?m.stringifyUrl({url:i,query:{modelName:o,modelVersion:n}}):i}},providesTags:d.cacheByIdArgProperty(s.ProjectTags.FGMonitoringConfig,"fgId"),extraOptions:{skipError:!0}}),triggerMonitoringJob:g.mutation({query:({pId:t,name:r})=>({url:`project/${t}/jobs/${r}/executions`,headers:{"Content-Type":"text/plain"},method:"POST"}),invalidatesTags:(t,r,{pId:e,name:o})=>[s.ProjectTags.JobExecutions,{type:s.ProjectTags.Job,id:`${e}-${o}`}]}),updateFgMonitoringConfig:g.mutation({query:({pId:t,fsId:r,fgId:e,configId:o,enabled:n,triggerType:i})=>({url:`
            project/${t}/
            featurestores/${r}/
            featuregroups/${e}/
            featuremonitoring/config/${o}
          `.replace(/\s/g,""),method:"PUT",data:{enabled:n,triggerType:i}}),invalidatesTags:(t,r,{fgId:e})=>[{type:s.ProjectTags.FGMonitoringConfig,id:e},s.ProjectTags.ModelMonitoringConfig]}),deleteFgMonitoringConfig:g.mutation({query:({pId:t,fsId:r,fgId:e,configId:o})=>({url:`
            project/${t}/
            featurestores/${r}/
            featuregroups/${e}/
            featuremonitoring/config/${o}
          `.replace(/\s/g,""),method:"DELETE"}),invalidatesTags:(t,r,{fgId:e})=>[{type:s.ProjectTags.FGMonitoringConfig,id:e},s.ProjectTags.ModelMonitoringConfig]}),getFgMonitoringResult:g.query({query:({pId:t,fsId:r,fgId:e,configId:o,query:n={}})=>{const i={expand:"statistics",filter_by:[`monitoring_time_gte:${u({days:7},new Date).getTime()}`,`monitoring_time_lt:${new Date().getTime()}`]};return{url:m.stringifyUrl({url:`
              project/${t}/
              featurestores/${r}/
              featuregroups/${e}/
              featuremonitoring/result/byconfig/${o}
              `.replace(/\s/g,""),query:$(i,n)})}},providesTags:(t,r,{fgId:e})=>[{type:s.ProjectTags.FGMonitoringConfig,id:e}],transformResponse:f(c([],"items"),l(p("monitoringTime")))}),getFgMonitoringShiftsByConfigs:g.query({query:({pId:t,fsId:r,fgId:e,configIds:o})=>{const n=`
          project/${t}/
          featurestores/${r}/
          featuregroups/${e}/
          featuremonitoring/result/byconfigs/shifts
        `.replace(/\s/g,""),i=new URLSearchParams;return i.append("filter_by",`monitoring_time_gte:${u({days:7},new Date).getTime()}`),i.append("filter_by",`monitoring_time_lt:${new Date().getTime()}`),o.forEach(a=>i.append("configId",String(a))),{url:`${n}?${i.toString()}`}},providesTags:(t,r,{fgId:e})=>[{type:s.ProjectTags.FGMonitoringConfig,id:e}],transformResponse:t=>{const r=(t==null?void 0:t.items)??[],e={};return r.forEach(o=>{const n=o.shiftedFeatureNames??[];e[o.featureMonitoringConfigId]={shiftedFeatureCount:o.shiftedFeatureCount??n.length,shiftedFeatureNames:n,lastShiftAt:o.lastShiftAt??null}}),e}}),getFgMonitoringResultsByConfigs:g.query({query:({pId:t,fsId:r,fgId:e,configIds:o})=>{const n=`
          project/${t}/
          featurestores/${r}/
          featuregroups/${e}/
          featuremonitoring/result/byconfigs
        `.replace(/\s/g,""),i=new URLSearchParams;return i.append("filter_by",`monitoring_time_gte:${u({days:7},new Date).getTime()}`),i.append("filter_by",`monitoring_time_lt:${new Date().getTime()}`),o.forEach(a=>i.append("configId",String(a))),{url:`${n}?${i.toString()}`}},providesTags:(t,r,{fgId:e})=>[{type:s.ProjectTags.FGMonitoringConfig,id:e}],transformResponse:f(c([],"items"),l(p("monitoringTime")))})})}),{useGetFgMonitoringConfigByEntityQuery:C,useTriggerMonitoringJobMutation:j,useUpdateFgMonitoringConfigMutation:P,useDeleteFgMonitoringConfigMutation:q,useGetFgMonitoringResultQuery:b,useGetFgMonitoringResultsByConfigsQuery:E,useGetFgMonitoringShiftsByConfigsQuery:S,endpoints:G,util:R}=T;export{b as a,C as b,P as c,q as d,j as e,R as f,S as u};
