class SystemApiController implements SystemApi {

    @Override
    @PreAuthorize("hasAuthority('UPLOAD_ANCHOR')")
    public ResponseEntity<Anchor> previewAnchor(Boolean verifyInstance, Resource anchorResource) {
        byte[] anchorBytes = ResourceUtils.springResourceToBytesOrThrowBadRequest(anchorResource);
        AnchorFile anchorFile = null;
        try {
            anchorFile = systemService.getAnchorFileFromBytes(anchorBytes, verifyInstance);
        } catch (SystemService.InvalidAnchorInstanceException | SystemService.MalformedAnchorException e) {
            throw new BadRequestException(e);
        }
        return new ResponseEntity<>(anchorConverter.convert(anchorFile), HttpStatus.OK);
    }

    @Autowired public  SystemApiController(InternalTlsCertificateService internalTlsCertificateService,
            CertificateDetailsConverter certificateDetailsConverter, SystemService systemService,
            TimestampingServiceConverter timestampingServiceConverter, AnchorConverter anchorConverter,
            VersionService versionService, VersionConverter versionConverter, CsrFilenameCreator csrFilenameCreator,
            AuditDataHelper auditDataHelper);

}