diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts new file mode 100644 index 0000000..7ca36c4 --- /dev/null +++ b/web/src/lib/types.ts @@ -0,0 +1,103 @@ +export interface Ticket { + id: string; + subject: string; + queue_id: string; + status: string; + owner_id: string | null; + creator_id: string; + created_at: string; + updated_at: string; + started_at: string | null; + resolved_at: string | null; + custom_fields?: CustomFieldValue[]; +} + +export interface Queue { + id: string; + name: string; + description: string | null; + lifecycle_id: string | null; +} + +export interface Transaction { + id: string; + ticket_id: string; + transaction_type: string; + field: string | null; + old_value: string | null; + new_value: string | null; + data: unknown; + creator_id: string; + created_at: string; +} + +export interface Scrip { + id: string; + queue_id: string | null; + name: string; + condition_type: string; + action_type: string; + action_config: Record; + template_id: string | null; + stage: string; + sort_order: number; + disabled: boolean; +} + +export interface Template { + id: string; + name: string; + queue_id: string | null; + subject_template: string; + body_template: string; +} + +export interface Lifecycle { + id: string; + name: string; + definition: LifecycleDefinition; +} + +export interface LifecycleDefinition { + statuses: { initial: string[]; active: string[]; inactive: string[] }; + transitions: Record; +} + +export interface CustomField { + id: string; + name: string; + field_type: string; + values: unknown | null; + max_values: number; +} + +export interface CustomFieldValue { + id: string; + custom_field_id: string; + ticket_id: string; + value: string; + custom_field?: CustomField; +} + +export interface PreviewResult { + prepared_scrips: PreparedScrip[]; +} + +export interface PreparedScrip { + scripId: string; + scripName: string; + actionType: string; + actionPayload: unknown; + dryRun: boolean; +} + +export interface UpdateResult { + ticket: Ticket; + scrip_results: ScripResult[]; +} + +export interface ScripResult { + scripId: string; + success: boolean; + message: string; +}