package request

// CreateClientApprovalSettingsRequest represents request for creating client approval settings
type CreateClientApprovalSettingsRequest struct {
	RequiresApproval         bool     `json:"requiresApproval"`
	DefaultWorkflowId        *uint    `json:"defaultWorkflowId" validate:"omitempty,min=1"`
	AutoPublishArticles      bool     `json:"autoPublishArticles"`
	ApprovalExemptUsers      []uint   `json:"approvalExemptUsers" validate:"omitempty,dive,min=1"`
	ApprovalExemptRoles      []uint   `json:"approvalExemptRoles" validate:"omitempty,dive,min=1"`
	ApprovalExemptCategories []uint   `json:"approvalExemptCategories" validate:"omitempty,dive,min=1"`
	RequireApprovalFor       []string `json:"requireApprovalFor" validate:"omitempty,dive,min=1"`
	SkipApprovalFor          []string `json:"skipApprovalFor" validate:"omitempty,dive,min=1"`
	IsActive                 bool     `json:"isActive"`
}

// UpdateClientApprovalSettingsRequest represents request for updating client approval settings
type UpdateClientApprovalSettingsRequest struct {
	RequiresApproval         *bool    `json:"requiresApproval"`
	DefaultWorkflowId        **uint   `json:"defaultWorkflowId"` // double pointer to allow nil
	AutoPublishArticles      *bool    `json:"autoPublishArticles"`
	ApprovalExemptUsers      []uint   `json:"approvalExemptUsers" validate:"omitempty,dive,min=1"`
	ApprovalExemptRoles      []uint   `json:"approvalExemptRoles" validate:"omitempty,dive,min=1"`
	ApprovalExemptCategories []uint   `json:"approvalExemptCategories" validate:"omitempty,dive,min=1"`
	RequireApprovalFor       []string `json:"requireApprovalFor" validate:"omitempty,dive,min=1"`
	SkipApprovalFor          []string `json:"skipApprovalFor" validate:"omitempty,dive,min=1"`
	IsActive                 *bool    `json:"isActive"`
}

// ToggleApprovalRequest represents request for toggling approval requirement
type ToggleApprovalRequest struct {
	RequiresApproval bool `json:"requiresApproval"`
}

// EnableApprovalRequest represents request for enabling approval with smooth transition
type EnableApprovalRequest struct {
	DefaultWorkflowId *uint  `json:"defaultWorkflowId" validate:"omitempty,min=1"`
	Reason            string `json:"reason" validate:"omitempty,max=500"`
}

// DisableApprovalRequest represents request for disabling approval system
type DisableApprovalRequest struct {
	Reason       string `json:"reason" validate:"required,max=500"`
	HandleAction string `json:"handleAction" validate:"required,oneof=auto_approve keep_pending reset_to_draft"` // How to handle pending articles
}

// SetDefaultWorkflowRequest represents request for setting default workflow
type SetDefaultWorkflowRequest struct {
	WorkflowId *uint `json:"workflowId" validate:"omitempty,min=1"`
}

// AddExemptUserRequest represents request for adding user to exemption
type AddExemptUserRequest struct {
	UserId uint   `json:"userId" validate:"required,min=1"`
	Reason string `json:"reason" validate:"omitempty,max=500"`
}

// RemoveExemptUserRequest represents request for removing user from exemption
type RemoveExemptUserRequest struct {
	UserId uint   `json:"userId" validate:"required,min=1"`
	Reason string `json:"reason" validate:"omitempty,max=500"`
}

// AddExemptRoleRequest represents request for adding role to exemption
type AddExemptRoleRequest struct {
	RoleId uint   `json:"roleId" validate:"required,min=1"`
	Reason string `json:"reason" validate:"omitempty,max=500"`
}

// RemoveExemptRoleRequest represents request for removing role from exemption
type RemoveExemptRoleRequest struct {
	RoleId uint   `json:"roleId" validate:"required,min=1"`
	Reason string `json:"reason" validate:"omitempty,max=500"`
}

// AddExemptCategoryRequest represents request for adding category to exemption
type AddExemptCategoryRequest struct {
	CategoryId uint   `json:"categoryId" validate:"required,min=1"`
	Reason     string `json:"reason" validate:"omitempty,max=500"`
}

// RemoveExemptCategoryRequest represents request for removing category from exemption
type RemoveExemptCategoryRequest struct {
	CategoryId uint   `json:"categoryId" validate:"required,min=1"`
	Reason     string `json:"reason" validate:"omitempty,max=500"`
}
