package response

import (
	"time"
)

type ClientApprovalSettingsResponse struct {
	ID                       uint      `json:"id"`
	ClientId                 string    `json:"clientId"`
	RequiresApproval         bool      `json:"requiresApproval"`
	DefaultWorkflowId        *uint     `json:"defaultWorkflowId,omitempty"`
	AutoPublishArticles      bool      `json:"autoPublishArticles"`
	ApprovalExemptUsers      []uint    `json:"approvalExemptUsers"`
	ApprovalExemptRoles      []uint    `json:"approvalExemptRoles"`
	ApprovalExemptCategories []uint    `json:"approvalExemptCategories"`
	RequireApprovalFor       []string  `json:"requireApprovalFor"`
	SkipApprovalFor          []string  `json:"skipApprovalFor"`
	IsActive                 bool      `json:"isActive"`
	CreatedAt                time.Time `json:"createdAt"`
	UpdatedAt                time.Time `json:"updatedAt"`
}

type ClientApprovalSettingsDetailResponse struct {
	ID                       uint      `json:"id"`
	ClientId                 string    `json:"clientId"`
	RequiresApproval         bool      `json:"requiresApproval"`
	DefaultWorkflowId        *uint     `json:"defaultWorkflowId,omitempty"`
	AutoPublishArticles      bool      `json:"autoPublishArticles"`
	ApprovalExemptUsers      []uint    `json:"approvalExemptUsers"`
	ApprovalExemptRoles      []uint    `json:"approvalExemptRoles"`
	ApprovalExemptCategories []uint    `json:"approvalExemptCategories"`
	RequireApprovalFor       []string  `json:"requireApprovalFor"`
	SkipApprovalFor          []string  `json:"skipApprovalFor"`
	IsActive                 bool      `json:"isActive"`
	CreatedAt                time.Time `json:"createdAt"`
	UpdatedAt                time.Time `json:"updatedAt"`

	// Relations
	Client   *ClientResponse   `json:"client,omitempty"`
	Workflow *WorkflowResponse `json:"workflow,omitempty"`
}

type ClientResponse struct {
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	IsActive bool   `json:"isActive"`
}

type WorkflowResponse struct {
	ID          uint    `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
	IsActive    bool    `json:"isActive"`
}

type ApprovalStatusResponse struct {
	RequiresApproval    bool   `json:"requiresApproval"`
	AutoPublishArticles bool   `json:"autoPublishArticles"`
	IsActive            bool   `json:"isActive"`
	Message             string `json:"message,omitempty"`
}

type ExemptUserResponse struct {
	UserId uint   `json:"userId"`
	Reason string `json:"reason,omitempty"`
}

type ExemptRoleResponse struct {
	RoleId uint   `json:"roleId"`
	Reason string `json:"reason,omitempty"`
}

type ExemptCategoryResponse struct {
	CategoryId uint   `json:"categoryId"`
	Reason     string `json:"reason,omitempty"`
}

type ApprovalTransitionResponse struct {
	Success          bool   `json:"success"`
	Message          string `json:"message"`
	AffectedArticles int    `json:"affectedArticles,omitempty"`
}
