package entity

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

type ApprovalWorkflows struct {
	ID          uint       `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
	Name        string     `json:"name" gorm:"type:varchar;not null"`
	Description *string    `json:"description" gorm:"type:text"`
	IsDefault   *bool      `json:"is_default" gorm:"type:bool;default:false"`
	IsActive    *bool      `json:"is_active" gorm:"type:bool;default:true"`
	// New fields for no-approval support
	RequiresApproval *bool      `json:"requires_approval" gorm:"type:bool;default:true"` // false = no approval needed
	AutoPublish      *bool      `json:"auto_publish" gorm:"type:bool;default:false"`     // true = auto publish after creation
	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
	Steps []ApprovalWorkflowSteps `json:"steps" gorm:"foreignKey:WorkflowId;constraint:OnDelete:CASCADE"`
}