package dto

import "time"

// ReviewFeedbackSubmitRequest submits the current review draft as one visible IM
// feedback message in the review context's target conversation.
type ReviewFeedbackSubmitRequest struct {
	ContextID       string                      `json:"contextId,omitempty"`
	ClientMessageID string                      `json:"clientMessageId,omitempty"`
	Locale          string                      `json:"locale,omitempty"`
	Decision        string                      `json:"decision,omitempty"`
	Summary         string                      `json:"summary,omitempty"`
	Refs            map[string]any              `json:"refs,omitempty"`
	Items           []ReviewFeedbackItemRequest `json:"items"`
}

type ReviewFeedbackItemRequest struct {
	ID                string         `json:"id,omitempty"`
	Type              string         `json:"type,omitempty"`
	Kind              string         `json:"kind,omitempty"`
	Path              string         `json:"path,omitempty"`
	OldPath           string         `json:"oldPath,omitempty"`
	Side              string         `json:"side,omitempty"`
	OldLine           *int64         `json:"oldLine,omitempty"`
	NewLine           *int64         `json:"newLine,omitempty"`
	StartLine         *int64         `json:"startLine,omitempty"`
	EndLine           *int64         `json:"endLine,omitempty"`
	HunkHeader        string         `json:"hunkHeader,omitempty"`
	AnchorFingerprint string         `json:"anchorFingerprint,omitempty"`
	CodePreview       string         `json:"codePreview,omitempty"`
	Body              string         `json:"body"`
	Anchor            map[string]any `json:"anchor,omitempty"`
	Metadata          map[string]any `json:"metadata,omitempty"`
}

type ReviewFeedbackStatusRequest struct {
	ContextID string `json:"contextId,omitempty"`
	Status    string `json:"status"`
}

type ReviewFeedbackMessage struct {
	ID              string                      `json:"id"`
	ReviewContextID string                      `json:"reviewContextId"`
	SourceAgentID   string                      `json:"sourceAgentId,omitempty"`
	Status          string                      `json:"status"`
	Decision        string                      `json:"decision,omitempty"`
	Content         string                      `json:"content,omitempty"`
	CreatedAt       time.Time                   `json:"createdAt,omitempty"`
	UpdatedAt       *time.Time                  `json:"updatedAt,omitempty"`
	Refs            map[string]any              `json:"refs,omitempty"`
	Items           []ReviewFeedbackItemMessage `json:"items"`
}

type ReviewFeedbackItemMessage struct {
	ID                    string `json:"id"`
	FeedbackMessageID     string `json:"feedbackMessageId"`
	Type                  string `json:"type,omitempty"`
	Path                  string `json:"path,omitempty"`
	OldPath               string `json:"oldPath,omitempty"`
	Side                  string `json:"side,omitempty"`
	OldLine               *int64 `json:"oldLine,omitempty"`
	NewLine               *int64 `json:"newLine,omitempty"`
	StartLine             *int64 `json:"startLine,omitempty"`
	EndLine               *int64 `json:"endLine,omitempty"`
	HunkHeader            string `json:"hunkHeader,omitempty"`
	AnchorFingerprint     string `json:"anchorFingerprint,omitempty"`
	CodePreview           string `json:"codePreview,omitempty"`
	Body                  string `json:"body"`
	Status                string `json:"status"`
	AuthorMemberID        string `json:"authorMemberId,omitempty"`
	AuthorDisplayName     string `json:"authorDisplayName,omitempty"`
	CreatedAt             string `json:"createdAt,omitempty"`
	ResolvedByMemberID    string `json:"resolvedByMemberId,omitempty"`
	ResolvedByDisplayName string `json:"resolvedByDisplayName,omitempty"`
	ResolvedAt            string `json:"resolvedAt,omitempty"`
}

type ReviewFeedbackListResponse struct {
	Feedback []ReviewFeedbackMessage `json:"feedback"`
}

type ReviewFeedbackMessageResponse struct {
	Feedback ReviewFeedbackMessage `json:"feedback"`
}
