package dto

import "time"

// TeamWorkflowErrorResponse contains a bounded authoring failure. It is
// present only while authoringStatus is failed.
type TeamWorkflowErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message,omitempty"`
}

// TeamWorkflowActionsResponse describes operations available to the current
// authenticated creator. Authorization remains server-side; these booleans
// are UI affordances, not capabilities.
type TeamWorkflowActionsResponse struct {
	CanOpen    bool `json:"canOpen"`
	CanRetry   bool `json:"canRetry"`
	CanArchive bool `json:"canArchive"`
	CanRestore bool `json:"canRestore"`
	CanDelete  bool `json:"canDelete"`
}

// TeamWorkflowResponse is the creator-private Team Workflow relation. ID is
// the relation id used by nested detail/delete routes; it is never a planId.
type TeamWorkflowResponse struct {
	ID              string                      `json:"id"`
	TeamID          string                      `json:"teamId"`
	Revision        int64                       `json:"revision"`
	Status          string                      `json:"status"`
	AuthoringStatus string                      `json:"authoringStatus"`
	Availability    string                      `json:"availability"`
	Plan            *WorkflowPlanResponse       `json:"plan,omitempty"`
	Error           *TeamWorkflowErrorResponse  `json:"error,omitempty"`
	Actions         TeamWorkflowActionsResponse `json:"actions"`
	CreatedAt       time.Time                   `json:"createdAt"`
	UpdatedAt       time.Time                   `json:"updatedAt"`
}

type TeamWorkflowListResponse struct {
	Items      []TeamWorkflowResponse `json:"items"`
	NextCursor string                 `json:"nextCursor,omitempty"`
}
