package entity import ( "time" "github.com/google/uuid" ) type ArticleApprovalFlows struct { ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"` ArticleId uint `json:"article_id" gorm:"type:int4;not null"` WorkflowId uint `json:"workflow_id" gorm:"type:int4;not null"` CurrentStep int `json:"current_step" gorm:"type:int4;default:1"` StatusId int `json:"status_id" gorm:"type:int4;default:1"` // 1=pending, 2=approved, 3=rejected, 4=revision_requested SubmittedById uint `json:"submitted_by_id" gorm:"type:int4;not null"` SubmittedAt time.Time `json:"submitted_at" gorm:"default:now()"` CompletedAt *time.Time `json:"completed_at" gorm:"type:timestamp"` RejectionReason *string `json:"rejection_reason" gorm:"type:text"` RevisionRequested *bool `json:"revision_requested" gorm:"type:bool;default:false"` RevisionMessage *string `json:"revision_message" gorm:"type:text"` // Multi-branch support fields CurrentBranch *string `json:"current_branch" gorm:"type:varchar(100)"` // Current active branch BranchPath *string `json:"branch_path" gorm:"type:text"` // JSON array tracking the path taken IsParallelFlow *bool `json:"is_parallel_flow" gorm:"type:bool;default:false"` // Whether this is a parallel approval flow ParentFlowId *uint `json:"parent_flow_id" gorm:"type:int4;references:article_approval_flows(id)"` // For parallel flows ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` // Relations Article Articles `json:"article" gorm:"foreignKey:ArticleId;constraint:OnDelete:CASCADE"` Workflow ApprovalWorkflows `json:"workflow" gorm:"foreignKey:WorkflowId"` SubmittedBy *Users `json:"submitted_by" gorm:"foreignKey:SubmittedById"` StepLogs []ArticleApprovalStepLogs `json:"step_logs" gorm:"foreignKey:ApprovalFlowId;constraint:OnDelete:CASCADE"` ParentFlow *ArticleApprovalFlows `json:"parent_flow" gorm:"foreignKey:ParentFlowId"` ChildFlows []ArticleApprovalFlows `json:"child_flows" gorm:"foreignKey:ParentFlowId"` }