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