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 // ScenarioJSON — описание сценария в архиве; Story — в формате колонки // scenarios.scenario в БД. 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"` } // Scenario — данные сценария, необходимые для сборки архива. 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 } // IScenarioArchive — контракт модуля scenario_archive: сборка и разбор // ZIP-архива сценария. type IScenarioArchive interface { // Pack собирает ZIP-архив сценария: ссылки на изображения хранилища // переписываются в images/<имя>, файлы запрашиваются через getFile; // внешние URL остаются без изменений. Pack( ctx context.Context, scenario *Scenario, domain string, getFile func(ctx context.Context, name string) ([]byte, error), ) ([]byte, error) // Unpack разбирает входящий архив с проверкой лимитов и путей записей. Unpack(data []byte) (*Bundle, error) }