Files
pfm/PostFundManagement.ConsoleUI/src/types.ts
T

987 lines
21 KiB
TypeScript

/**
* Post Fund Management (PFM) Console - Domain & API Types
* Based on OpenAPI 3.1.1 specification and PFM System Requirements Specification v2.0
*/
// ==========================================
// Enumerations
// ==========================================
export enum EmailStatuses {
GeneralError = 0,
AuthenticationError = 1,
ProtocolError = 2,
Connected = 3,
Disconnected = 4,
TooManyConnections = 5,
ConnectionAborted = 6,
Success = 7,
}
export enum NotificationStatus {
Pending = 1,
Queued = 2,
Processing = 3,
Sent = 4,
Delivered = 5,
Read = 6,
Failed = 7,
Cancelled = 8,
Bounced = 9,
}
export enum NotificationPlatform {
Email = 1,
SMS = 2,
WhatsApp = 3,
PushNotification = 4,
InApp = 5,
Teams = 6,
Slack = 7,
Webhook = 8,
Other = 99,
}
export enum EvidenceType {
AttendanceRegister = 1,
BankStatement = 2,
CompletionCertificate = 3,
FinancialInvoiceOrReceipt = 4,
GeotaggedPhoto = 5,
InspectionReport = 6,
MeetingMinutes = 7,
PayrollOrStipendRegister = 8,
ProcurementDocument = 9,
TechnicalSpecificationOrDesign = 10,
VideoRecording = 11,
Other = 99,
// Compatibility aliases
ProgressReport = 1,
FinancialStatement = 2,
Invoice = 4,
DeliverableProof = 10,
Certification = 3,
AuditReport = 6,
}
export enum ProjectType {
CapacityBuildingAndTraining = 1,
CapitalExpenditureAndInfrastructure = 2,
CommercializationAndScaling = 3,
FeasibilityAndTechnicalAssistance = 4,
OperationalGrantAndSubsidy = 5,
ProductDevelopmentAndPrototyping = 6,
ResearchAndDevelopment = 7,
SocialImpactAndCommunityDevelopment = 8,
TechnologyTransferAndAdoption = 9,
Innovation = 10,
Other = 99,
// Compatibility aliases
Grant = 5,
BlendedFinance = 3,
TechnicalAssistance = 4,
}
export enum IndustrySector {
AgricultureAndAgroProcessing = 1,
AutomotiveAndTransportEquipment = 2,
ChemicalsAndPharmaceuticals = 3,
ConstructionAndInfrastructure = 4,
CreativeIndustriesAndMedia = 5,
DefenseAndAerospace = 6,
EducationAndSkillsDevelopment = 7,
EnergyAndUtilities = 8,
FinancialServices = 9,
HealthcareAndLifeSciences = 10,
InformationCommunicationTechnology = 11,
ManufacturingAndIndustrial = 12,
MiningAndMetals = 13,
RealEstateAndHousing = 14,
RetailAndConsumerGoods = 15,
TourismAndHospitality = 16,
WaterAndSanitation = 17,
Other = 99,
// Compatibility aliases
AgriTech = 1,
CleanEnergy = 8,
HealthTech = 10,
Education = 7,
ICTDigital = 11,
Manufacturing = 12,
SocialDevelopment = 15,
}
export enum OrganisationType {
NonGovernmentalOrganisation = 1,
CivilSocietyOrganisation = 2,
Trust = 3,
FaithBasedOrganisation = 4,
PrivateLimitedCompany = 5,
PublicLimitedCompany = 6,
SoleProprietorship = 7,
Partnership = 8,
SocialEnterprise = 9,
NationalGovernmentMinistry = 10,
ProvincialGovernmentEntity = 11,
LocalGovernmentMunicipality = 12,
StateOwnedEnterprise = 13,
PublicAgency = 14,
PublicUniversity = 15,
PrivateUniversity = 16,
ResearchInstitute = 17,
TechnicalVocationalCollege = 18,
Cooperative = 19,
MicrofinanceInstitution = 20,
CommercialBank = 21,
DevelopmentFinanceInstitution = 22,
UnitedNationsAgency = 23,
IntergovernmentalOrganisation = 24,
InternationalNGO = 25,
Consortium = 26,
SpecialPurposeVehicle = 27,
// Compatibility aliases
GovernmentDepartment = 10,
CorporateCSI = 3,
Enterprise = 5,
}
export enum Priority {
Low = 1,
Medium = 2,
High = 3,
Critical = 4,
}
export enum UnitOfMeasure {
Count = 1,
Percentage = 2,
Currency = 3,
Area = 4,
Weight = 5,
Volume = 6,
DurationDays = 7,
DurationMonths = 8,
Ratio = 9,
// Compatibility alias
CurrencyZAR = 3,
}
export enum ContractStatus {
Draft = 1,
PendingApproval = 2,
Active = 3,
Expired = 4,
Terminated = 5,
Amended = 6,
// Compatibility aliases
UnderReview = 2,
Executed = 3,
}
export enum RiskLikelihood {
Rare = 1,
Unlikely = 2,
Possible = 3,
Likely = 4,
AlmostCertain = 5,
// Compatibility aliases
VeryLow = 1,
Low = 2,
Medium = 3,
High = 4,
VeryHigh = 5,
}
export enum RiskImpact {
Minor = 1,
Moderate = 2,
Major = 3,
Critical = 4,
Severe = 5,
// Compatibility aliases
Insignificant = 1,
}
export enum ApprovalStatus {
Pending = 1,
Review = 2,
Approved = 3,
Rejected = 4,
Removed = 5,
// Compatibility aliases
Draft = 1,
PendingReview = 2,
}
export enum ActivityStatus {
Active = 1,
Inactive = 2,
Disabled = 3,
// Compatibility alias
Suspended = 3,
}
// ==========================================
// Entities
// ==========================================
export interface ProblemDetails {
type?: string | null;
title?: string | null;
status?: number | null;
detail?: string | null;
instance?: string | null;
errors?: Record<string, string[] | string> | any;
[key: string]: any;
}
export interface Dashboard {
portfolioValue: number;
activeAwards: number;
disbursed: number;
onTrackPercentage: number;
atRiskCount: number;
beneficiariesReached: number;
}
export enum UserRole {
SuperAdmin = 1,
Executive = 2,
ProgrammeManager = 3,
FinanceOfficer = 4,
RecipientViewer = 5,
}
export interface User {
id: string;
email: string | null;
status: ActivityStatus;
lastLoginAt: string | null;
role?: string | UserRole;
name?: string;
organisationId?: number | string;
organisationName?: string;
tenant?: string;
tenant_id?: number;
}
export type SystemUser = User;
export interface InviteUserRequest {
email: string;
role: UserRole;
organisationId: number | string;
}
export interface AuditLog {
id: number | string;
tenantId?: number | string | null;
entityName?: string | null;
entityId?: string | null;
action?: string | null;
changes?: string[] | null;
performedBy: string;
timestamp: string;
}
export interface UserFilterRequest {
status?: ActivityStatus | null;
email?: string | null;
sortBy?: string | null;
sortDescending?: boolean;
organisationId?: number | string | null;
}
export interface Organisation {
id: number | string;
name: string | null;
registrationNo: string | null;
email: string | null;
type: OrganisationType;
status: ActivityStatus;
createdAt: string;
createdBy: string;
}
export interface CreateOrganisationRequest {
name: string;
registrationNo: string;
email: string;
type: OrganisationType;
}
export interface UpdateOrganisationRequest {
organisationId: number | string;
name: string;
registrationNo: string;
email: string;
type: OrganisationType;
status?: ActivityStatus;
}
export interface Portfolio {
id: number | string;
tenantId?: number | string;
organisationId: number | string;
name: string | null;
description: string | null;
ownedBy: string;
createdBy: string;
createdAt: string;
}
export interface CreatePortfolioRequest {
name: string;
description: string;
organisationId: number | string;
ownerId: string;
}
export interface UpdatePortfolioRequest {
portfolioId: number | string;
name: string;
description: string;
organisationId?: number | string;
ownerId: string;
}
export interface Programme {
id: number | string;
portfolioId: number | string;
tenantId?: number | string;
name: string | null;
status: ApprovalStatus;
ownedBy: string;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateProgrammeRequest {
portfolioId: number | string;
name: string;
ownerId: string;
}
export interface UpdateProgrammeRequest {
programmeId: number | string;
name: string;
ownerId: string;
status: ApprovalStatus;
portfolioId?: number | string;
}
export interface Instrument {
id: number | string;
programmeId: number | string;
tenantId?: number | string;
code: string | null;
name: string | null;
description: string | null;
status: ActivityStatus;
createdBy?: string;
createdAt?: string;
updatedBy?: string | null;
updatedAt?: string | null;
}
export interface CreateInstrumentRequest {
programmeId: number | string;
code?: string;
name: string;
description: string;
status?: ActivityStatus;
userId?: string;
}
export interface UpdateInstrumentRequest {
instructionId?: number | string;
instrumentId?: number | string;
id?: number | string;
programmeId?: number | string;
code?: string;
name: string;
description: string;
status: ActivityStatus;
userId?: string;
}
export type Instruction = Instrument;
export type CreateInstructionRequest = CreateInstrumentRequest;
export type UpdateInstructionRequest = UpdateInstrumentRequest;
export interface Project {
id: number | string;
programmeId: number | string;
tenantId?: number | string;
name: string | null;
description: string | null;
sector: IndustrySector;
projectType: ProjectType;
status: ApprovalStatus;
startedAt?: string | null;
endedAt?: string | null;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
programmeName?: string;
}
export interface CreateProjectRequest {
programmeId: number | string;
name: string;
description: string;
sector: IndustrySector;
projectType: ProjectType;
}
export interface UpdateProjectRequest {
projectId: number | string;
name: string;
description: string;
startedAt?: string | null;
endedAt?: string | null;
sector: IndustrySector;
projectType: ProjectType;
}
export interface UpdateProjectStatusRequest {
projectId: number | string;
status: ApprovalStatus;
}
export interface Activity {
id: number | string;
tenantId?: number | string;
projectId: number | string | null;
milestoneId: number | string | null;
category: string | null;
status: ApprovalStatus;
amount: number;
title: string | null;
description: string | null;
performedAt?: string | null;
createdBy: string;
updatedBy?: string | null;
approvedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateActivityRequest {
projectId: number | string;
milestoneId?: number | string | null;
category: string;
amount: number;
title: string;
description: string;
performedAt?: string | null;
}
export interface UpdateActivityRequest {
activityId: number | string;
projectId?: number | string;
milestoneId?: number | string | null;
category: string;
amount: number;
title: string;
description: string;
performedAt?: string | null;
status?: ApprovalStatus;
}
export interface Milestone {
id: number | string;
tenantId?: number | string;
projectId: number | string;
name: string | null;
dueAt: string;
status: ApprovalStatus;
priority: Priority;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateMilestoneRequest {
projectId: number | string;
name: string;
dueAt: string;
priority: Priority;
}
export interface UpdateMilestoneRequest {
milestoneId: number | string;
name: string;
dueAt: string;
priority: Priority;
status: ApprovalStatus;
}
export interface Award {
id: number | string;
organisationId: number | string;
tenantId?: number | string;
programmeId: number | string;
projectId?: number | string | null;
amount: number;
status: ApprovalStatus;
createdBy: string;
updatedBy?: string | null;
approvedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
referenceNo?: string;
organisationName?: string;
programmeName?: string;
}
export interface CreateAwardRequest {
organisationId: number | string;
programmeId: number | string;
amount: number;
referenceNo?: string;
fundingPeriod?: string;
}
export interface Contract {
id: number | string;
tenantId?: number | string;
awardId: number | string;
totalValue: number;
effectiveAt?: string | null;
expiresAt?: string | null;
status: ContractStatus;
externalSignatureId?: string | null;
signedDocumentUrl?: string | null;
createdBy: string;
createdAt: string;
}
export interface CreateContractRequest {
awardId: number | string;
totalValue: number;
effectiveAt: string;
expiresAt: string;
}
export interface UpdateContractRequest {
contractId: number | string;
status: ContractStatus;
}
export interface ExecuteContractRequest {
contractId: number | string;
externalSignatureId: string;
signedDocumentUrl: string;
}
export interface Budget {
id: number | string;
tenantId?: number | string;
projectId: number | string;
name: string | null;
amount: number;
status?: ApprovalStatus;
createdBy: string;
approvedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateBudgetRequest {
projectId: number | string;
name: string;
amount: number;
}
export interface UpdateBudgetRequest {
budgetId: number | string;
status: ApprovalStatus;
}
export interface Disbursement {
id: number | string;
tenantId?: number | string;
projectId: number | string;
milestoneId?: number | string | null;
amount: number;
status: ApprovalStatus;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
paymentReference?: string | null;
conditionsChecked?: boolean;
}
export interface CreateDisbursementRequest {
projectId: number | string;
milestoneId?: number | string | null;
amount: number;
}
export interface UpdateDisbursementRequest {
disbursementId: number | string;
milestoneId?: number | string | null;
amount: number;
}
export interface Indicator {
id: number | string;
tenantId?: number | string;
projectId: number | string;
name: string | null;
unitOfMeasure?: UnitOfMeasure | null;
baselineAmount: number;
targetAmount: number;
actualAmount: number;
createdBy: string;
createdAt: string;
}
export interface CreateIndicatorRequest {
projectId: number | string;
name: string;
unitOfMeasure: UnitOfMeasure;
baselineAmount: number;
targetAmount: number;
}
export interface Risk {
id: number | string;
tenantId?: number | string;
projectId: number | string;
name: string | null;
description: string | null;
likelihood: RiskLikelihood;
impact: RiskImpact;
createdBy: string;
createdAt: string;
owner?: string;
mitigationAction?: string;
status?: string;
}
export interface CreateRiskRequest {
projectId: number | string;
name: string;
description: string;
likelihood: RiskLikelihood;
impact: RiskImpact;
}
export interface UpdateRiskRequest {
riskId: number | string;
name: string;
description: string;
likelihood: RiskLikelihood;
impact: RiskImpact;
}
export interface Evidence {
id: number | string;
tenantId?: number | string;
projectId: number | string;
milestoneId?: number | string | null;
indicatorId?: number | string | null;
activityId?: number | string | null;
version: number;
type: EvidenceType;
documentUrl?: string | null;
status: ApprovalStatus;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
fileName?: string;
fileSize?: string;
}
export interface UpdateEvidenceRequest {
evidenceId: number | string;
version: number;
evidenceType: EvidenceType;
status: ApprovalStatus;
}
export interface Invite {
id: number | string;
tenantId?: number | string;
organisationId: number | string;
invitedOrganisationId: number | string;
awardId: number | string;
contractId: number | string;
recipient: string;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
message?: string;
platform?: NotificationPlatform;
}
export interface InviteRequest {
organisationId: number | string;
invitedOrganisationId: number | string;
awardId: number | string;
contractId: number | string;
recipient: string;
message: string;
platform: NotificationPlatform;
}
// ==========================================
// New OpenAPI 3.1.1 Entities & Request Models
// ==========================================
export interface Tenant {
id: number | string;
name: string | null;
status?: ActivityStatus;
createdBy?: string;
createdAt?: string;
updatedBy?: string | null;
updatedAt?: string | null;
creator?: User | null;
updator?: User | null;
}
export interface CreateTenantRequest {
name: string;
}
export interface UpdateTenantRequest {
tenantId: number | string;
name: string;
status: ActivityStatus;
}
export interface Beneficiary {
id: number | string;
tenantId?: number | string;
projectId: number | string;
userId?: string;
createdBy?: string;
createdAt?: string;
name: string | null;
category: string | null;
targetCount?: number;
reachedCount?: number;
location: string | null;
}
export interface CreateBeneficiaryRequest {
projectId: number | string;
name: string;
category: string;
location: string;
targetCount: number;
reachedCount: number;
}
export interface UpdateBeneficiaryRequest {
beneficiaryId: number | string;
name: string;
category: string;
location: string;
targetCount: number;
reachedCount: number;
}
export interface Outcome {
id: number | string;
tenantId?: number | string;
beneficiaryId: number | string;
name: string | null;
description: string | null;
createdBy?: string;
createdAt?: string;
}
export interface CreateOutcomeRequest {
beneficiaryId: number | string;
name: string;
description: string;
}
export interface UpdateOutcomeRequest {
outcomeId: number | string;
name: string;
description: string;
}
export interface ChangeRequest {
id: number | string;
tenantId?: number | string;
projectId: number | string;
title: string | null;
justification: string | null;
revisedBudget?: number | null;
revisedEndedAt?: string | null;
status: ApprovalStatus;
createdBy: string;
approvedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateChangeRequest {
projectId: number | string;
title: string;
justification: string;
revisedBudget: number;
revisionDate: string;
}
export interface UpdateChangeRequest {
changeRequestId: number | string;
title: string;
justification: string;
revisedBudget: number;
status: ApprovalStatus;
}
export interface ComplianceItem {
id: number | string;
tenantId?: number | string;
projectId: number | string;
title: string | null;
requirements: string | null;
status: ApprovalStatus;
createdBy: string;
verifiedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
}
export interface CreateComplianceItemRequest {
projectId: number | string;
title: string;
requirements: string;
}
export interface UpdateComplianceItemRequest {
complianceItemId: number | string;
title: string;
requirements: string;
status: ApprovalStatus;
}
export interface Issue {
id: number | string;
tenantId?: number | string;
projectId: number | string;
title: string | null;
description: string | null;
priority: Priority;
status: ActivityStatus;
createdBy: string;
createdAt: string;
assignedTo?: string | null;
resolvedAt?: string | null;
resolution?: string | null;
}
export interface CreateIssueRequest {
projectId: number | string;
title: string;
description: string;
priority: Priority;
assignedTo: string;
}
export interface UpdateIssueRequest {
issueId: number | string;
title: string;
description: string;
resolution: string;
resolvedAt?: string | null;
priority: Priority;
status: ActivityStatus;
assignedTo: string;
}
export interface SiteVisit {
id: number | string;
tenantId?: number | string;
projectId: number | string;
visitedAt: string;
inspectorName: string | null;
findings: string | null;
status: ApprovalStatus;
createdBy: string;
createdAt: string;
}
export interface CreateSiteVisitRequest {
projectId: number | string;
inspectorName: string;
findings: string;
visitedAt: string;
}
export interface UpdateSiteVisitRequest {
siteVisitId: number | string;
inspectorName: string;
findings: string;
status: ApprovalStatus;
visitedAt: string;
}
export interface Rule {
id: number | string;
tenantId?: number | string;
programmeId: number | string;
createdBy: string;
updatedBy?: string | null;
createdAt: string;
updatedAt?: string | null;
name: string | null;
description: string | null;
version?: number;
status: ActivityStatus;
}
export interface CreateRuleRequest {
programmeId: number | string;
userId: string;
name: string;
description: string;
}
export interface UpdateRuleRequest {
ruleId: number | string;
userId: string;
name: string;
description: string;
status: ActivityStatus;
version: number;
programmeId?: number | string;
}
export interface Pagination {
index?: number | string;
page?: number;
pageSize?: number;
}
export interface Notification {
id: number | string;
tenantId?: number | string;
organisationId: number | string;
recipient: string;
platform: NotificationPlatform;
status: NotificationStatus;
subject: string | null;
message: string | null;
destination: string | null;
createdAt: string;
sentAt?: string | null;
updatedAt?: string | null;
error?: string | null;
}