emr-types
Version:
Comprehensive TypeScript Types Library for Electronic Medical Record (EMR) Applications - Domain-Driven Design with Zod Validation
224 lines • 5.93 kB
TypeScript
/**
* Base Entity Interface
*
* Provides common properties for all domain entities
* following domain-driven design principles.
*
* @interface BaseEntity
* @description Base interface for all domain entities with common properties
*/
export interface BaseEntity {
/** Unique identifier for the entity */
id: string;
/** Timestamp when the entity was created */
createdAt: Date;
/** Timestamp when the entity was last updated */
updatedAt: Date;
/** Version number for optimistic locking */
version?: number;
/** Soft delete flag */
isDeleted?: boolean;
}
/**
* Base Entity with Tenant Context
*
* Extends BaseEntity with multi-tenant support
*
* @interface BaseTenantEntity
* @description Base interface for entities that belong to a specific tenant
*/
export interface BaseTenantEntity extends BaseEntity {
/** Associated tenant identifier */
tenantId: string;
/** Tenant-specific database schema */
tenantSchema?: string;
}
/**
* Base Entity with Audit Metadata
*
* Extends BaseEntity with audit trail information
*
* @interface BaseAuditEntity
* @description Base interface for entities with audit trail
*/
export interface BaseAuditEntity extends BaseEntity {
/** User who created the entity */
createdBy: string;
/** User who last updated the entity */
updatedBy: string;
/** IP address of the user who created the entity */
createdFromIp?: string;
/** IP address of the user who last updated the entity */
updatedFromIp?: string;
/** User agent of the client that created the entity */
createdUserAgent?: string;
/** User agent of the client that last updated the entity */
updatedUserAgent?: string;
}
/**
* Base Entity with Full Audit and Tenant Support
*
* Combines audit metadata with tenant context
*
* @interface BaseFullEntity
* @description Base interface for entities with full audit trail and tenant support
*/
export interface BaseFullEntity extends BaseAuditEntity, BaseTenantEntity {
/** Additional metadata for the entity */
metadata?: Record<string, any>;
}
/**
* Entity Status Enum
*
* Common status values for entities
*
* @enum EntityStatus
*/
export declare enum EntityStatus {
ACTIVE = "active",
INACTIVE = "inactive",
SUSPENDED = "suspended",
DELETED = "deleted",
PENDING = "pending",
APPROVED = "approved",
REJECTED = "rejected"
}
/**
* Entity with Status
*
* Base entity with status tracking
*
* @interface BaseStatusEntity
* @description Base interface for entities with status tracking
*/
export interface BaseStatusEntity extends BaseEntity {
/** Current status of the entity */
status: EntityStatus;
/** Timestamp when status was last changed */
statusChangedAt?: Date;
/** User who last changed the status */
statusChangedBy?: string;
/** Reason for status change */
statusChangeReason?: string;
}
/**
* Entity with Priority
*
* Base entity with priority tracking
*
* @interface BasePriorityEntity
* @description Base interface for entities with priority tracking
*/
export interface BasePriorityEntity extends BaseEntity {
/** Priority level of the entity */
priority: Priority;
/** Timestamp when priority was last changed */
priorityChangedAt?: Date;
/** User who last changed the priority */
priorityChangedBy?: string;
}
/**
* Priority Enum
*
* Common priority values for entities
*
* @enum Priority
*/
export declare enum Priority {
LOW = "low",
NORMAL = "normal",
HIGH = "high",
URGENT = "urgent",
CRITICAL = "critical"
}
/**
* Entity with Tags
*
* Base entity with tag support
*
* @interface BaseTaggedEntity
* @description Base interface for entities with tag support
*/
export interface BaseTaggedEntity extends BaseEntity {
/** Tags associated with the entity */
tags?: string[];
/** Categories associated with the entity */
categories?: string[];
/** Labels associated with the entity */
labels?: Record<string, string>;
}
/**
* Entity with Notes
*
* Base entity with note support
*
* @interface BaseNotedEntity
* @description Base interface for entities with note support
*/
export interface BaseNotedEntity extends BaseEntity {
/** Notes associated with the entity */
notes?: string;
/** Internal notes (not visible to end users) */
internalNotes?: string;
/** Notes history */
notesHistory?: NoteEntry[];
}
/**
* Note Entry Interface
*
* Represents a single note entry
*
* @interface NoteEntry
*/
export interface NoteEntry {
/** Note content */
content: string;
/** User who created the note */
createdBy: string;
/** Timestamp when note was created */
createdAt: Date;
/** Note type */
type?: 'note' | 'comment' | 'warning' | 'error' | 'info';
/** Whether the note is internal */
isInternal?: boolean;
}
/**
* Entity with Attachments
*
* Base entity with file attachment support
*
* @interface BaseAttachedEntity
* @description Base interface for entities with file attachment support
*/
export interface BaseAttachedEntity extends BaseEntity {
/** File attachments associated with the entity */
attachments?: Attachment[];
}
/**
* Attachment Interface
*
* Represents a file attachment
*
* @interface Attachment
*/
export interface Attachment {
/** Unique identifier for the attachment */
id: string;
/** Original filename */
filename: string;
/** File size in bytes */
size: number;
/** MIME type */
mimeType: string;
/** File path or URL */
path: string;
/** User who uploaded the file */
uploadedBy: string;
/** Timestamp when file was uploaded */
uploadedAt: Date;
/** File description */
description?: string;
/** Whether the file is public */
isPublic?: boolean;
}
//# sourceMappingURL=BaseEntity.d.ts.map