class FileAssetService implements AssetService {

    @Override
    public String saveScreenshot(byte[] screenshot, String scenarioName) {
        try {
            // fileHomeFolder is something like /opt/assets
            // subFolder is something like /screenshots
            // The full path of the folder is then something like /opt/assets/screenshots
            final String subFolder = araConfiguration.getFileScreenshotSubFolder();
            final String absoluteFolderPath = araConfiguration.getFileHomeFolder() + subFolder;
            final String fileName = fileNameService.generateReportFileName(scenarioName, "png");
            final File file = new File(absoluteFolderPath + File.separator + fileName);

            // Will create directories if they do not exist
            FileUtils.writeByteArrayToFile(file, screenshot);

            return araConfiguration.getFileHttpAccess() + subFolder + "/" + fileName;
        } catch (IOException e) {
            log.error("Screenshot saving failed: {}", e.getMessage(), e);
            return null;
        }
    }

}