package entity

import (
	"github.com/google/uuid"
	"time"
)

type ArticleApprovalStepLogs struct {
	ID             uint       `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
	ApprovalFlowId uint       `json:"approval_flow_id" gorm:"type:int4;not null"`
	StepOrder      int        `json:"step_order" gorm:"type:int4;not null"`
	StepName       string     `json:"step_name" gorm:"type:varchar;not null"`
	ApprovedById   *uint      `json:"approved_by_id" gorm:"type:int4"`
	Action         string     `json:"action" gorm:"type:varchar;not null"` // approve, reject, request_revision
	Message        *string    `json:"message" gorm:"type:text"`
	ProcessedAt    time.Time  `json:"processed_at" gorm:"default:now()"`
	UserLevelId    uint       `json:"user_level_id" gorm:"type:int4;not null"`
	ClientId       *uuid.UUID `json:"client_id" gorm:"type:UUID"`
	CreatedAt      time.Time  `json:"created_at" gorm:"default:now()"`

	// Relations
	ApprovalFlow ArticleApprovalFlows `json:"approval_flow" gorm:"foreignKey:ApprovalFlowId;constraint:OnDelete:CASCADE"`
	ApprovedBy   Users               `json:"approved_by" gorm:"foreignKey:ApprovedById"`
	UserLevel    UserLevels           `json:"user_level" gorm:"foreignKey:UserLevelId"`
}