v1

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package v1 contains schema definitions for version 1.x

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CFConfig

type CFConfig struct {
	Handle          string   `yaml:"handle" json:"handle"`
	DefaultLanguage string   `yaml:"defaultLanguage" json:"defaultLanguage"`
	PreferredTags   []string `yaml:"preferredTags,omitempty" json:"preferredTags,omitempty"`
}

CFConfig holds Codeforces-specific settings

type DailyProgress

type DailyProgress struct {
	Date      string   `yaml:"date" json:"date"` // YYYY-MM-DD
	Solved    int      `yaml:"solved" json:"solved"`
	Attempted int      `yaml:"attempted" json:"attempted"`
	Problems  []string `yaml:"problems" json:"problems"`   // Problem IDs
	TimeSpent int      `yaml:"timeSpent" json:"timeSpent"` // seconds
}

DailyProgress represents a single day's progress

type PathConfig

type PathConfig struct {
	Problems    string `yaml:"problems" json:"problems"`
	Templates   string `yaml:"templates" json:"templates"`
	Submissions string `yaml:"submissions" json:"submissions"`
	Stats       string `yaml:"stats" json:"stats"`
}

PathConfig holds relative paths within workspace

type PracticeConfig

type PracticeConfig struct {
	DifficultyMin int `yaml:"difficultyMin" json:"difficultyMin"`
	DifficultyMax int `yaml:"difficultyMax" json:"difficultyMax"`
	DailyGoal     int `yaml:"dailyGoal" json:"dailyGoal"`
	WeeklyGoal    int `yaml:"weeklyGoal,omitempty" json:"weeklyGoal,omitempty"`
}

PracticeConfig holds practice session settings

type PracticeData

type PracticeData struct {
	Status         PracticeStatus `yaml:"status" json:"status"`
	FirstAttempt   *time.Time     `yaml:"firstAttempt,omitempty" json:"firstAttempt,omitempty"`
	SolvedAt       *time.Time     `yaml:"solvedAt,omitempty" json:"solvedAt,omitempty"`
	AttemptCount   int            `yaml:"attemptCount" json:"attemptCount"`
	BestSubmission *int64         `yaml:"bestSubmission,omitempty" json:"bestSubmission,omitempty"`
	TimeSpent      int            `yaml:"timeSpent,omitempty" json:"timeSpent,omitempty"` // seconds
}

PracticeData holds user's practice progress

type PracticeStatus

type PracticeStatus string

PracticeStatus represents the practice state

const (
	StatusUnseen    PracticeStatus = "unseen"
	StatusAttempted PracticeStatus = "attempted"
	StatusSolved    PracticeStatus = "solved"
)

type Problem

type Problem struct {
	Schema schema.SchemaHeader `yaml:"_schema" json:"_schema"`

	// Identity
	ID        string `yaml:"id" json:"id"`               // e.g., "1325A"
	Platform  string `yaml:"platform" json:"platform"`   // "codeforces"
	ContestID int    `yaml:"contestId" json:"contestId"` // e.g., 1325
	Index     string `yaml:"index" json:"index"`         // e.g., "A"

	// Basic info
	Name string `yaml:"name" json:"name"`
	URL  string `yaml:"url" json:"url"`

	// Metadata from platform
	Metadata ProblemMetadata `yaml:"metadata" json:"metadata"`

	// Constraints
	Limits ProblemLimits `yaml:"limits" json:"limits"`

	// Sample test cases
	Samples []Sample `yaml:"samples" json:"samples"`

	// User practice data
	Practice PracticeData `yaml:"practice" json:"practice"`

	// User notes
	Notes UserNotes `yaml:"notes,omitempty" json:"notes,omitempty"`

	// Fetch metadata
	FetchedAt   time.Time `yaml:"fetchedAt" json:"fetchedAt"`
	FetchMethod string    `yaml:"fetchMethod" json:"fetchMethod"` // "api", "web", "cache"
}

Problem represents a problem stored locally (problem.yaml)

func NewProblem

func NewProblem(contestID int, index, name string) *Problem

NewProblem creates a new problem with defaults

type ProblemLimits

type ProblemLimits struct {
	TimeLimit   string `yaml:"timeLimit" json:"timeLimit"`
	MemoryLimit string `yaml:"memoryLimit" json:"memoryLimit"`
	InputType   string `yaml:"inputType" json:"inputType"`   // "standard input" or filename
	OutputType  string `yaml:"outputType" json:"outputType"` // "standard output" or filename
}

ProblemLimits holds problem constraints

type ProblemMetadata

type ProblemMetadata struct {
	Rating      int      `yaml:"rating" json:"rating"`
	Tags        []string `yaml:"tags" json:"tags"`
	SolvedCount int      `yaml:"solvedCount,omitempty" json:"solvedCount,omitempty"`
}

ProblemMetadata holds platform-provided metadata

type Progress

type Progress struct {
	Schema schema.SchemaHeader `yaml:"_schema" json:"_schema"`

	// Lifetime stats
	TotalSolved    int `yaml:"totalSolved" json:"totalSolved"`
	TotalAttempted int `yaml:"totalAttempted" json:"totalAttempted"`
	TotalTime      int `yaml:"totalTime" json:"totalTime"` // seconds

	// Rating distribution of solved problems
	RatingDistribution map[string]int `yaml:"ratingDistribution" json:"ratingDistribution"`

	// Tag distribution
	TagDistribution map[string]int `yaml:"tagDistribution" json:"tagDistribution"`

	// Streak tracking
	CurrentStreak int        `yaml:"currentStreak" json:"currentStreak"`
	LongestStreak int        `yaml:"longestStreak" json:"longestStreak"`
	LastActivity  *time.Time `yaml:"lastActivity,omitempty" json:"lastActivity,omitempty"`

	// Daily entries
	Daily []DailyProgress `yaml:"daily,omitempty" json:"daily,omitempty"`
}

Progress represents overall progress tracking

func NewProgress

func NewProgress() *Progress

NewProgress creates a new progress tracker

func (*Progress) AddAttempted

func (p *Progress) AddAttempted(problemID string, timeSpent int)

AddAttempted records an attempted problem

func (*Progress) AddSolved

func (p *Progress) AddSolved(problemID string, rating int, tags []string, timeSpent int)

AddSolved records a solved problem

type Sample

type Sample struct {
	Index  int    `yaml:"index" json:"index"`
	Input  string `yaml:"input" json:"input"`
	Output string `yaml:"output" json:"output"`
}

Sample represents a sample test case

type Submission

type Submission struct {
	Schema schema.SchemaHeader `yaml:"_schema" json:"_schema"`

	// Identity
	ID        int64  `yaml:"id" json:"id"`
	ProblemID string `yaml:"problemId" json:"problemId"`
	ContestID int    `yaml:"contestId" json:"contestId"`

	// Timestamp
	SubmittedAt time.Time `yaml:"submittedAt" json:"submittedAt"`

	// Submission details
	Language   string `yaml:"language" json:"language"`
	LanguageID int    `yaml:"languageId" json:"languageId"`

	// Result
	Verdict    Verdict `yaml:"verdict" json:"verdict"`
	TimeUsed   string  `yaml:"timeUsed" json:"timeUsed"`
	MemoryUsed string  `yaml:"memoryUsed" json:"memoryUsed"`

	// Source reference
	SourceFile string `yaml:"sourceFile" json:"sourceFile"`
	SourceHash string `yaml:"sourceHash,omitempty" json:"sourceHash,omitempty"`
}

Submission represents a submission record

func NewSubmission

func NewSubmission(id int64, problemID string, contestID int, language string, langID int) *Submission

NewSubmission creates a new submission record

type UserNotes

type UserNotes struct {
	Difficulty string   `yaml:"difficulty,omitempty" json:"difficulty,omitempty"` // User perception
	CustomTags []string `yaml:"customTags,omitempty" json:"customTags,omitempty"`
	Approach   string   `yaml:"approach,omitempty" json:"approach,omitempty"`
	Reminder   string   `yaml:"reminder,omitempty" json:"reminder,omitempty"`
	Review     bool     `yaml:"review,omitempty" json:"review,omitempty"`
}

UserNotes holds user's personal notes

type Verdict

type Verdict string

Verdict represents submission verdict

const (
	VerdictOK                  Verdict = "OK"
	VerdictWrongAnswer         Verdict = "WRONG_ANSWER"
	VerdictTimeLimitExceeded   Verdict = "TIME_LIMIT_EXCEEDED"
	VerdictMemoryLimitExceeded Verdict = "MEMORY_LIMIT_EXCEEDED"
	VerdictRuntimeError        Verdict = "RUNTIME_ERROR"
	VerdictCompilationError    Verdict = "COMPILATION_ERROR"
	VerdictPending             Verdict = "PENDING"
	VerdictTesting             Verdict = "TESTING"
)

func (Verdict) IsAccepted

func (v Verdict) IsAccepted() bool

IsAccepted returns true if verdict is OK

type Workspace

type Workspace struct {
	Schema schema.SchemaHeader `yaml:"_schema" json:"_schema"`

	// Workspace identity
	Name        string `yaml:"name" json:"name"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	// Timestamps
	CreatedAt time.Time `yaml:"createdAt" json:"createdAt"`
	UpdatedAt time.Time `yaml:"updatedAt" json:"updatedAt"`

	// Platform configuration
	Codeforces CFConfig `yaml:"codeforces" json:"codeforces"`

	// Practice settings
	Practice PracticeConfig `yaml:"practice" json:"practice"`

	// Path configuration
	Paths PathConfig `yaml:"paths" json:"paths"`
}

Workspace represents the workspace manifest (workspace.yaml)

func DefaultWorkspace

func DefaultWorkspace() *Workspace

DefaultWorkspace returns a workspace with empty handle

func NewWorkspace

func NewWorkspace(name, handle string) *Workspace

NewWorkspace creates a new workspace with defaults

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL