62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { z } from 'zod'
|
|
|
|
export const ResourceSchema = z.object({
|
|
id: z.string().uuid(),
|
|
processId: z.string().uuid(),
|
|
name: z.string().min(1, 'El nombre es requerido'),
|
|
type: z.enum(['role', 'person', 'system', 'equipment', 'supply']),
|
|
costPerHour: z.number().min(0, 'El costo no puede ser negativo'),
|
|
})
|
|
|
|
export const ActivityResourceAssignmentSchema = z.object({
|
|
resourceId: z.string().uuid(),
|
|
utilizationMinutes: z.number().min(0, 'Los minutos no pueden ser negativos'),
|
|
units: z.number().int().min(1, 'Las unidades deben ser al menos 1').default(1),
|
|
})
|
|
|
|
export const ActivitySchema = z.object({
|
|
id: z.string().uuid(),
|
|
processId: z.string().uuid(),
|
|
bpmnElementId: z.string().min(1),
|
|
name: z.string(),
|
|
type: z.enum(['task', 'subprocess']),
|
|
directCostFixed: z.number().min(0),
|
|
executionTimeMinutes: z.number().min(0),
|
|
assignedResources: z.array(ActivityResourceAssignmentSchema),
|
|
automatable: z.boolean().default(false),
|
|
automatedCostFixed: z.number().min(0).default(0),
|
|
automatedTimeMinutes: z.number().min(0).default(0),
|
|
})
|
|
|
|
export const GatewayBranchSchema = z.object({
|
|
flowId: z.string(),
|
|
targetElementId: z.string(),
|
|
probability: z.number().min(0).max(1),
|
|
})
|
|
|
|
export const GatewayConfigSchema = z.object({
|
|
id: z.string().uuid(),
|
|
processId: z.string().uuid(),
|
|
bpmnElementId: z.string().min(1),
|
|
gatewayType: z.enum(['exclusive', 'parallel', 'inclusive', 'event-based']),
|
|
branches: z.array(GatewayBranchSchema),
|
|
})
|
|
|
|
export const ProcessSchema = z.object({
|
|
id: z.string().uuid(),
|
|
name: z.string().min(1, 'El nombre del proceso es requerido'),
|
|
clientName: z.string(),
|
|
bpmnXml: z.string().min(1),
|
|
currency: z.string().length(3, 'Código ISO de 3 letras'),
|
|
overheadPercentage: z.number().min(0).max(1),
|
|
annualFrequency: z.number().min(1).default(1000),
|
|
analysisHorizonYears: z.number().min(1).max(20).default(3),
|
|
automationInvestment: z.number().min(0).default(0),
|
|
createdAt: z.number(),
|
|
updatedAt: z.number(),
|
|
})
|
|
|
|
export type ResourceInput = z.infer<typeof ResourceSchema>
|
|
export type ActivityInput = z.infer<typeof ActivitySchema>
|
|
export type ProcessInput = z.infer<typeof ProcessSchema>
|