import{aA as r,h as s,i as a,aS as d}from"./app-BgLa5dit.js";const I=r.object().shape({externalId:r.string().required("School district is required")}),m=r.object().shape({providerId:r.string().required("Rostering provider is required")}),S=r.object().shape({masterId:r.string().required("Master ID is required"),externalId:r.string().required("External ID is required")}),u=r.object().shape({mappings:r.array().of(S).min(1,"At least one mapping is required").required(" ").test("unique-masterIds","You cannot map the same ClickView school to multiple schools",e=>{if(!e)return!0;const t=e.map(p=>p.masterId),i=new Set(t);return t.length===i.size})});var l=(e=>(e.SELECT_PROVIDER="select_provider",e.SET_UP_ROSTERING="set_up_rostering",e.SELECT_EXTERNAL="select_external",e.MAPPING="mapping",e.CONFIRMATION="confirmation",e))(l||{});const _={select_provider:{id:"select_provider",label:"Select a provider",nextStep:"set_up_rostering",appLink:{application:a.CRM_STUDIO,action:s.CrmStudio.ORGANISATION_ROSTERING_WIZARD_SELECT_PROVIDER},previousStep:null,schema:m},set_up_rostering:{id:"set_up_rostering",label:"Set up rostering",nextStep:"select_external",appLink:{application:a.CRM_STUDIO,action:s.CrmStudio.ORGANISATION_ROSTERING_WIZARD_SET_UP_ROSTERING},previousStep:"select_provider",schema:null},select_external:{id:"select_external",label:"Select a school district",nextStep:"mapping",appLink:{application:a.CRM_STUDIO,action:s.CrmStudio.ORGANISATION_ROSTERING_WIZARD_SELECT_EXTERNAL},previousStep:"set_up_rostering",schema:I},mapping:{id:"mapping",label:"Map schools into ClickView",nextStep:"confirmation",previousStep:e=>e.integrationId?null:"select_external",appLink:{application:a.CRM_STUDIO,action:s.CrmStudio.ORGANISATION_ROSTERING_WIZARD_MAPPING},schema:u},confirmation:{id:"confirmation",label:"Review and confirm",nextStep:null,previousStep:"mapping",appLink:{application:a.CRM_STUDIO,action:s.CrmStudio.ORGANISATION_ROSTERING_WIZARD_CONFIRMATION},schema:null}},g={getRosteringWizardSteps(e,t,i){const p=[];return Object.values(_).forEach(n=>{const o=i&&(n.id===l.SELECT_PROVIDER||n.id===l.SET_UP_ROSTERING||n.id===l.SELECT_EXTERNAL),c={id:n.id,text:n.label,disabled:o,appLink:{...n.appLink,args:[e],params:t}};p.push(c)}),p},convertQueryParamsToData(e){const t=e.mappings&&e.mappings!=="[]";if(!t)return e;const i=d.omit(e,["mappings"]),n=(t?JSON.parse(e.mappings):[]).map(o=>({externalId:o.eId,masterId:o.mId}));return{...i,mappings:n}},getEditQueryParams(e,t){return!e||!t?null:{externalId:e.externalId,providerId:e.provider,integrationId:e.id,mappings:JSON.stringify(t.map(i=>({eId:i.externalId,mId:i.masterId})))}},convertDataToQueryParams(e){return!e.mappings||!e.mappings.length?e:{...e,mappings:JSON.stringify(e.mappings.map(t=>({eId:t.externalId,mId:t.masterId})))}},buildRosteringRequest(e,t){return{provider:t.providerId,organisationId:e,rosterExternalId:t.externalId,customerMappings:t.mappings}}};export{g as R,l as a,_ as b};
//# sourceMappingURL=KotJtg73.chunk.js.map
