import{G as a}from"./index-b983ad9b.js";const g=new Map;class r{constructor(t){this.setData(t)}setData(t){Object.assign(this,t)}static async getTriggers(t={}){const e=a();try{const{items:s}=await e.get({path:"api/v1/mono-event-triggers",query:t});return s==null?void 0:s.map(n=>new r(n))}catch(s){return console.log(s),[]}}static async getTrigger(t){let e=g.get(t);if(e===void 0){const n=await a().get(`api/v1/mono-event-trigger/${t}`);e=new r(n),g.set(t,e)}return e}static async addTrigger(t){const s=await a().post("api/v1/mono-event-trigger",{measurement:t,enabled:!0,rules:[]}),n=new r(s);return g.set(t,n),n}static async updateTrigger(t,e){if(!t)return;const n=await a().patch(`api/v1/mono-event-trigger/${t}`,e),i=new r(n);return g.set(t,i),i}static async deleteTrigger(t){if(!t)return;await a().delete(`api/v1/mono-event-trigger/${t}`),g.delete(t)}static async getDevicesTrigger(t){const s=await a().get({path:"/api/v1/mono-event-trigger-devices",query:t});return new r(s)}}const o=r;export{o as M};
