import { AutomationAPI } from '@core/typings/api/automation.typing'; import { ProgramApplicantType } from '@core/typings/program.typing'; import { ReferenceFieldsUI } from '@core/typings/ui/reference-fields.typing'; import { AdaptedForm, FormDefinitionForUi, FormioAnswerValues, ProgramFormFromApi } from '@features/configure-forms/form.typing'; export const Program_Automation_Table_Key = 'PROGRAM_AUTOMATION'; export interface ProgramAutomationRowFromApi { id: number; name: string; formId: number; grantProgramRoutingRulesCount: number; complete: boolean; draft: boolean; isArchived: boolean; landingLinkGuid: string; } export interface ProgramAutomationRowForUi extends ProgramAutomationRowFromApi { routingFormName: string; } export enum ProgramAutomationTableAction { PUBLISH = 1, ARCHIVE = 2, DELETE = 3 } export enum AutomationBuilderModalTabType { Details = 1, Rules = 2, Fallback_Program = 3, Share = 4 } export interface ProgramAutomationRuleset { grantProgramRoutingAutomationRuleSetId: number; rules: AutomationAPI.AutomationRuleSetExpressionBaseModel[]; sequence: number; routeToGrantProgramId: number; applyRulesWithOr: boolean; createdDate: string; updatedDate: string; name: string; description: string; formName: string; formId: number; } export interface ProgramAutomationRulesetForUi extends ProgramAutomationRuleset { programName: string; valid: boolean; } export interface BaseProgramAutomationDetail { id: number; name: string; description: string; formId: number; isArchived: boolean; draft: boolean; complete: boolean; landingLinkGuid: string; fallbackGrantProgramId: number; ruleSetFailureMessage: string; programApplicantType: ProgramApplicantType; } export interface ProgramAutomationDetailFromApi extends BaseProgramAutomationDetail { grantProgramRoutingAutomationRuleSets: ProgramAutomationRuleset[]; } export interface ProgramAutomationDetailForUi extends BaseProgramAutomationDetail { grantProgramRoutingAutomationRuleSets: ProgramAutomationRulesetForUi[]; } export interface SaveAutomationApi { grantProgramRoutingDetailsId: number; draft: boolean; complete: boolean; formId: number; fallbackGrantProgramId: number; name: string; description: string; failureMessage: string; programApplicantType: ProgramApplicantType; } export interface SaveRuleset { grantProgramRoutingDetailsId: number; grantProgramRoutingAutomationRuleSetId: number; routeToGrantProgramId: number; name: string; description: string; applyRulesWithOr: boolean; formId: number; rules: AutomationAPI.SaveAutomationRuleSetExpressionModel[]; } export interface RulesetSequencePayload { ruleSets: { grantProgramRoutingAutomationRuleSetId: number; sequence: number; }[]; grantProgramRoutingDetailsId: number; } export interface ProgramAutomationForApplicantApi { name: string; description: string; ruleSetFailureMessage: string; fallbackGrantProgramGuid: string; isArchived: boolean; formId: number; formRevisionId: number; clientLogoUrl: string; clientId: number; clientName: string; formDefinition: FormDefinitionForUi[]; } export interface ProgramAutomationForApplicantUi extends ProgramAutomationForApplicantApi { form: AdaptedForm; } export interface ProgramRoutingApplyPayload { clientId: number; landingLinkGuid: string; form: ProgramAutomationForm; } export interface ProgramAutomationForm { formId: number; formRevisionId: number; formResponse: { currencyRequested: string; amountRequested: number; referenceFields: { value: FormioAnswerValues; id: number; }[]; }; } export interface ProgramRoutingApplyResponse { grantProgramName: string; grantProgramId: number; grantProgramGuid: string; message: string; isFallbackProgram: boolean; noProgramToRouteTo: boolean; } export interface RoutingAppForSave { formId: number; formRevisionId: number; amountRequested: number; currencyRequested: string; referenceFields: ReferenceFieldsUI.RefResponseMap; programId: number; programGuid: string; }