submission = $submission; $this->to = $to; $this->genres = $genres; } /** * Add a list of files that can be copied to the next stage * * @param bool $selectedByDefault Whether the files in this list should be selected by default */ public function addFileList(string $name, Collector $collector, bool $selectedByDefault = true): self { $files = $collector->getMany(); $fileSummaries = Repo::submissionFile() ->getSchemaMap() ->summarizeMany($files, $this->genres); $this->lists[] = [ 'name' => $name, 'files' => $fileSummaries->values(), ]; if ($selectedByDefault && $files->count()) { $this->selected = array_merge( $this->selected, $files->map(fn ($file) => $file->getId())->all() ); } return $this; } public function getState(): stdClass { $config = parent::getState(); $config->to = $this->to; $config->selected = $this->selected; $config->lists = $this->lists; return $config; } }