// Package adapters are the backend to that connects the marka server to a storage
package adapters

import "time"

// Entry represents a file or directory in the filesystem.
type Entry struct {
	Type    string    `json:"type"`              // "file" | "dir"
	Name    string    `json:"name"`              // base name
	Path    string    `json:"path"`              // full path or virtual path
	ModTime time.Time `json:"modTime"`           // last modified

	// File-only (optional)
	MIME string `json:"mime,omitempty"` // e.g. "text/markdown"
	Size int64  `json:"size,omitempty"` // bytes

	// Content:
	// - markdown file: any (parsed AST / arbitrary JSON)
	// - directory: []*Entry (children)
	// - other files: omitted
	Content any `json:"content,omitempty"`
}

// FileAdapter is the interface for accessing the file system.
type FileAdapter interface {
	Read(path string) (*Entry, error)
	Write(path string, content []byte) error
}