// Package production implements the messenger application operations. package production import ( "fmt" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/service" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab3/internal/store" ) // Service orchestrates operations through storage and cursor interfaces. type Service struct { repo store.Interface cursors service.CursorCodec cache service.ProfileCache } var _ service.Service = (*Service)(nil) // New creates an application service using explicitly supplied dependencies. func New(repo store.Interface, cursors service.CursorCodec) (*Service, error) { if repo == nil || cursors == nil { return nil, fmt.Errorf("store and cursor codec are required") } return &Service{repo: repo, cursors: cursors}, nil } // NewCached builds the business service with optional immutable-profile caching. func NewCached(repo store.Interface, cursors service.CursorCodec, cache service.ProfileCache) (*Service, error) { instance, err := New(repo, cursors) if err != nil { return nil, err } if cache == nil { return nil, fmt.Errorf("profile cache is required") } instance.cache = cache return instance, nil }