import { Injectable } from '@angular/core'; import { HttpRestService } from '@core/services/http-rest.service'; import { PaginatedResponse, PaginationOptions } from '@yourcause/common'; import { ProgramAutomationDetailFromApi, ProgramAutomationForApplicantApi, ProgramAutomationRowFromApi, ProgramAutomationRuleset, ProgramRoutingApplyPayload, ProgramRoutingApplyResponse, SaveAutomationApi, SaveRuleset } from './program-automation.typing'; @Injectable({ providedIn: 'root' }) export class ProgramAutomationResources { constructor ( private http: HttpRestService ) { } getProgramAutomationDetail (id: number): Promise { const endpoint = `/api/manager/GrantProgramRoutingAutomation/${id}/GrantProgramRoutingAutomationSets`; return this.http.get(endpoint); } getProgramAutomationRecords ( paginationOptions: PaginationOptions ): Promise> { const endpoint = 'api/manager/GrantProgramRoutingAutomation/GrantProgramRoutingDetails/Paginated'; return this.http.post(endpoint, { paginationOptions }); } saveProgramAutomation ( payload: SaveAutomationApi ): Promise<{ grantProgramRoutingDetailsId: number; grantProgramRoutingLinkGuid: string; }> { const endpoint = '/api/manager/GrantProgramRoutingAutomation/GrantProgramRoutingDetails'; return this.http.post(endpoint, payload); } saveRuleset ( payload: SaveRuleset ): Promise { const endpoint = 'api/manager/GrantProgramRoutingAutomation/GrantProgramRoutingAutomationSet'; return this.http.post(endpoint, payload); } getRoutingInfoForApplicant ( landingLinkGuid: string ): Promise { const endpoint = 'api/portal/programs/GetProgramRouting'; return this.http.post(endpoint, { landingLinkGuid }); } submitProgramRouting ( payload: ProgramRoutingApplyPayload ): Promise { const endpoint = '/api/portal/programs/ApplyProgramRoutingRules'; return this.http.post(endpoint, payload); } }