import{Ec as p,Vg as l,ah as m,mi as D,ri as v,v as d}from"./chunk-AIXI6G7V.js";import{ca as h,ea as S}from"./chunk-J6V2RHPS.js";var n=class{constructor(t,o,e,r){this.name=t,this.shortName=o,this.sourceType=e,this.systemModules=r}deserialize(t){return this.name=t.name,this.shortName=t.source_system,this.sourceType=t.source_type,this.systemModules=[],t.modules.forEach(o=>{let e=new p().deserialize(o);this.systemModules.push(e)}),this}},C=class{constructor(t){this.enabled=!0,this.sourceSystem=t}};var s=function(i){return i.MSSQL="MSSQL",i.ORACLE="ORACLE",i.ODBC="ODBC",i.JDBC="JDBC",i.AZURE="AZURE",i.SAP="SAP",i}(s||{});var B=(()=>{let t=class{constructor(e){this.httpService=e,this.apiRoute="/api/DataSource",this.sourceSystems={[s.MSSQL]:new n("Microsoft SQL Server",s.MSSQL,s.MSSQL,[]),[s.ORACLE]:new n("Oracle",s.ORACLE,s.ORACLE,[]),[s.ODBC]:new n(s.ODBC,s.ODBC,s.ODBC,[]),[s.JDBC]:new n(s.JDBC,s.JDBC,s.JDBC,[]),[s.SAP]:new n(s.SAP,s.SAP,s.SAP,[]),[s.AZURE]:new n("Azure Storage",s.AZURE,s.AZURE,[])}}getAllDataSources(e,r){return this.httpService.get(`${this.apiRoute}/${e}/${r}/datasources`)}getDataSource(e,r,a){return this.httpService.get(`${this.apiRoute}/${e}/${r}/datasources/${a}`)}postDataSource(e,r,a){return this.httpService.post(`${this.apiRoute}/${r}/${a}/datasources`,e)}deleteDataSource(e,r,a){return this.httpService.delete(`${this.apiRoute}/${e}/${r}/datasources/${a}`)}testConnection(e,r,a){return this.httpService.post(`${this.apiRoute}/${r}/${a}/test-connection`,e)}getDatabaseDataSourceConnectionString(e,r,a){return this.httpService.post(`${this.apiRoute}/${e}/${r}/connection-string`,a)}getAllDatabases(e,r,a){return this.httpService.post(`${this.apiRoute}/${e}/${r}/databases`,a)}getServerName(){return this.httpService.get(`${this.apiRoute}/server-name`)}getAllLocalMsSqlServer(){return this.httpService.get(`${this.apiRoute}/local-mssql-servers`)}updateSAPChunkSize(e,r,a){return this.httpService.post(`${this.apiRoute}/${e}/${r}/sap-chunk-size/${a}`,{})}getSAPChunkSize(e,r){return this.httpService.get(`${this.apiRoute}/${e}/${r}/sap-chunk-size`)}},i=t;return(()=>{t.\u0275fac=function(r){return new(r||t)(S(d))}})(),(()=>{t.\u0275prov=h({token:t,factory:t.\u0275fac,providedIn:"root"})})(),i})();var u=class{deserialize(t){return this.dataSourceID=t.dataSourceID,this.dataSourceName=t.dataSourceName,this.sourceType=t.sourceType,this}},Q=(i,t=[])=>{let o=e=>{let r=e.map(c=>parseInt(c.dataSourceID,10)).filter(c=>!isNaN(c));return`${r.length>0?Math.max(...r)+1:1}`};return new m({value:i?.dataSourceID??o(t),disabled:i?.dataSourceID!=null},[l.required,D(t,"dataSourceID"),v()])};var $=class extends u{constructor(t,o,e,r,a,c,f,A,R,g,I){super(),this.sourceType=t,this.servername=o,this.isPortSelected=e,this.portOrInstance=r,this.isWindowsAuth=a,this.username=c,this.password=f,this.isDatabaseNameProvided=A,this.database=R,this.trustServerCertificate=g,this.customConnectionString=I}static isDatabaseDataSource(t){return t==s.MSSQL||t==s.ORACLE}deserialize(t){return super.deserialize(t),(this.sourceType==s.MSSQL||this.sourceType==s.ORACLE)&&this.deserializeDatabaseConnection(t),this}deserializeDatabaseConnection(t){if(t.connectionValuesJSON!=null){let o=JSON.parse(t.connectionValuesJSON);this.servername=o.Servername,this.isPortSelected=o.IsPortSelected,this.portOrInstance=o.PortOrInstance,this.isWindowsAuth=o.IsWindowsAuth,this.username=o.Username,this.password=o.Password,this.database=o.Database,this.isDatabaseNameProvided=o.IsDatabaseNameProvided,this.trustServerCertificate=o.TrustServerCertificate,this.customConnectionString=o.CustomConnectionString}}};export{C as a,s as b,B as c,u as d,Q as e,$ as f};
