import{g as m,s as i}from"./api.ecc2e6e0.js";import{r as o,w as s,E as d}from"./vue.adf17aba.js";const r=a=>{const e=o({campaignId:a.data.campaignId,campaignType:a.data.campaignType,profileId:a.data.profileId,ruleType:a.data.ruleType,templateName:"",useTmpl:!1,rule:{type:a.data.ruleType,campaignType:a.data.campaignType,campaignAd:[],action:{},activeModel:"",setTime:"",weekdays:[],conditions:[]},RuleStatusButton:a.RuleStatusButton}),u=async()=>{const l=(await m(a.data)).data[0];l&&(e.value=l,l.template?(e.value.useTmpl=!0,e.value.rule=l.template.rule):e.value.useTmpl=!1)},n=async()=>{const t={campaignId:e.value.campaignId,campaignType:e.value.campaignType,profileId:e.value.profileId,ruleType:e.value.ruleType,RuleStatusButton:e.value.RuleStatusButton,rule:null,templateName:e.value.templateName};e.value.useTmpl?t.templateId=e.value.template.id:(t.rule=e.value.rule,delete t.rule.modifier_name,delete t.rule.id),await i(t),console.log("=>(common.ts:68) body",t)};return s(()=>a.RuleStatusButton,()=>{e.value.RuleStatusButton=a.RuleStatusButton},{deep:!0}),d(async()=>{await u()}),{formData:e,submitFormData:n}};export{r as u};
