package store import ( "context" "database/sql" "os" "path/filepath" "time" _ "github.com/mattn/go-sqlite3" ) type Store struct { db *sql.DB } type SiteContent struct { HeroTitle string HeroSubtitle string Positioning string HeroCTALabel string HeroCTAURL string SecondaryCTALabel string SecondaryCTAURL string IntroTitle string IntroText string ServiceOneTitle string ServiceOneText string ServiceTwoTitle string ServiceTwoText string ServiceThreeTitle string ServiceThreeText string ProcessOneTitle string ProcessOneText string ProcessTwoTitle string ProcessTwoText string ProcessThreeTitle string ProcessThreeText string AboutName string AboutRole string AboutBio string StudioPhilosophy string StudioApproach string StudioCredentials string ServiceArea string Email string Phone string Location string HeroImage string AboutImage string } type Project struct { ID int64 Slug string Title string Location string Year string Category string Summary string Scope string Status string Position int Description string CoverImage string Featured bool CreatedAt time.Time Images []ProjectImage } type ProjectImage struct { ID int64 ProjectID int64 Path string Caption string Position int } type Service struct { ID int64 Title string Summary string Details string Position int Active bool CreatedAt time.Time } type FAQ struct { ID int64 Question string Answer string Position int Active bool CreatedAt time.Time } type ContactRequest struct { ID int64 Name string Email string Phone string ProjectType string ProjectLocation string BudgetRange string Timeline string Message string Status string Notes string CreatedAt time.Time } type AdminUser struct { ID int64 Username string PasswordHash []byte } func Open(path string) (*Store, error) { if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { return nil, err } db, err := sql.Open("sqlite3", path+"?_foreign_keys=on") if err != nil { return nil, err } db.SetMaxOpenConns(1) return &Store{db: db}, db.Ping() } func (s *Store) Close() error { return s.db.Close() } func (s *Store) Ping(ctx context.Context) error { return s.db.PingContext(ctx) }