package models import "time" // AnalysisRequest represents the request to analyze a repository type AnalysisRequest struct { RepoURL string `json:"repo_url" binding:"required"` Token string `json:"token,omitempty"` Options Options `json:"options,omitempty"` } // Options for analysis type Options struct { IncludeTests bool `json:"include_tests"` MaxDepth int `json:"max_depth"` ExcludeVendor bool `json:"exclude_vendor"` IncludeDependencies bool `json:"include_dependencies"` } // AnalysisResult contains the analyzed repository structure type AnalysisResult struct { ID string `json:"id"` RepoURL string `json:"repo_url"` RepoName string `json:"repo_name"` CreatedAt time.Time `json:"created_at"` Status string `json:"status"` Error string `json:"error,omitempty"` Structure RepositoryStructure `json:"structure"` Stats Statistics `json:"stats"` } // RepositoryStructure represents the file/directory structure type RepositoryStructure struct { Name string `json:"name"` Type string `json:"type"` // "file" or "directory" Path string `json:"path"` Language string `json:"language,omitempty"` Size int64 `json:"size,omitempty"` Children []RepositoryStructure `json:"children,omitempty"` Dependencies []string `json:"dependencies,omitempty"` Imports []string `json:"imports,omitempty"` } // Statistics about the repository type Statistics struct { TotalFiles int `json:"total_files"` TotalDirectories int `json:"total_directories"` Languages map[string]int `json:"languages"` MainLanguage string `json:"main_language"` TotalLines int `json:"total_lines"` } // Diagram represents the generated architecture diagram type Diagram struct { ID string `json:"id"` RepoID string `json:"repo_id"` CreatedAt time.Time `json:"created_at"` SVG []byte `json:"-"` JSON DiagramJSON `json:"json"` Version string `json:"version"` } // DiagramJSON is the JSON representation of the diagram type DiagramJSON struct { Nodes []DiagramNode `json:"nodes"` Edges []DiagramEdge `json:"edges"` Settings DiagramSettings `json:"settings"` } // DiagramNode represents a component/node in the diagram type DiagramNode struct { ID string `json:"id"` Label string `json:"label"` Type string `json:"type"` // "package", "module", "file", "directory" Properties map[string]interface{} `json:"properties,omitempty"` Position Position `json:"position,omitempty"` Style NodeStyle `json:"style,omitempty"` } // DiagramEdge represents a connection/relationship between nodes type DiagramEdge struct { ID string `json:"id"` Source string `json:"source"` Target string `json:"target"` Type string `json:"type"` // "import", "dependency", "contains" Label string `json:"label,omitempty"` Style EdgeStyle `json:"style,omitempty"` } // DiagramSettings for rendering type DiagramSettings struct { Layout string `json:"layout"` // "hierarchical", "circular", "force" Direction string `json:"direction"` // "TB", "LR", "RL", "BT" RankSep int `json:"rank_sep"` NodeSep int `json:"node_sep"` ShowLabels bool `json:"show_labels"` Cluster bool `json:"cluster"` } // Position for nodes type Position struct { X float64 `json:"x"` Y float64 `json:"y"` } // NodeStyle for visual appearance type NodeStyle struct { Shape string `json:"shape"` Color string `json:"color"` Border string `json:"border"` Font Font `json:"font"` } // EdgeStyle for visual appearance type EdgeStyle struct { Color string `json:"color"` Width int `json:"width"` Style string `json:"style"` // "solid", "dashed", "dotted" ArrowHead string `json:"arrow_head"` LabelOffset int `json:"label_offset"` } // Font settings type Font struct { Name string `json:"name"` Size int `json:"size"` Color string `json:"color"` } // AnalysisResponse for API response type AnalysisResponse struct { ID string `json:"id"` Status string `json:"status"` Message string `json:"message"` } // ErrorResponse for API errors type ErrorResponse struct { Error string `json:"error"` } // WorkerTask represents a background analysis task type WorkerTask struct { ID string Result *AnalysisResult Diagram *Diagram ErrChan chan error DoneChan chan bool }