package gitea

import "time"

type FileResponse struct {
	Exists   bool
	ETag     []byte
	MimeType string
	Body     []byte
}

func (f FileResponse) IsEmpty() bool {
	return len(f.Body) != 0
}

type BranchTimestamp struct {
	Branch    string
	Timestamp time.Time
}

var (
	// defaultBranchCacheTimeout specifies the timeout for the default branch cache. It can be quite long.
	defaultBranchCacheTimeout = 15 * time.Minute

	// branchExistenceCacheTimeout specifies the timeout for the branch timestamp & existence cache. It should be shorter
	// than fileCacheTimeout, as that gets invalidated if the branch timestamp has changed. That way, repo changes will be
	// picked up faster, while still allowing the content to be cached longer if nothing changes.
	branchExistenceCacheTimeout = 5 * time.Minute

	// fileCacheTimeout specifies the timeout for the file content cache - you might want to make this quite long, depending
	// on your available memory.
	// TODO: move as option into cache interface
	// fileCacheTimeout = 5 * time.Minute

	// fileCacheSizeLimit limits the maximum file size that will be cached, and is set to 1 MB by default.
	// fileCacheSizeLimit = 1024 * 1024
)