Files
evening_detective_server/internal/modules/scenario_archive/interface.go
T
2026-10-03 13:22:11 +07:00

46 lines
1.0 KiB
Go

package scenario_archive
import (
"context"
"evening_detective_server/internal/modules/storytelling"
)
// FileName is the name of the scenario description inside an archive.
const FileName = "scenario.json"
// Version is the current scenario.json format version.
const Version = 1
type ScenarioJSON struct {
Version int `json:"version"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Image string `json:"image,omitempty"`
Story *storytelling.Story `json:"story"`
}
type Scenario struct {
Name string
Description *string
Image *string
Story string
}
// Bundle contains an archived scenario and its metadata.
type Bundle struct {
Scenario *ScenarioJSON
Files map[string][]byte
}
type IScenarioArchive interface {
Pack(
ctx context.Context,
scenario *Scenario,
domain string,
getFile func(ctx context.Context, name string) ([]byte, error),
) ([]byte, error)
Unpack(data []byte) (*Bundle, error)
}