class BlockController {

    @Path("/ec")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Operation(
        summary = "The API returns ECBlock info by timestamp",
        description = "The API returns ECBlockDTO by specified timestamp",
        tags = {"block"},
        responses = {
            @ApiResponse(responseCode = "200", description = "Successful execution",
                content = @Content(mediaType = "application/json",
                    schema = @Schema(implementation = ECBlockDTO.class)))
        })
    @PermitAll
    public Response getECBlock(
        @Parameter(description = "The earliest block (in seconds since the genesis block) to retrieve (optional)." )
            @QueryParam("timestamp") @DefaultValue("-1") @ValidTimestamp int timestamp
    ) {
        ResponseBuilder response = ResponseBuilder.startTiming();
        log.trace("Started getECBlock : \t timestamp={}", timestamp);
        if (timestamp <= 0) {
            timestamp = timeService.getEpochTime();
        }
        EcBlockData ecBlock = blockchain.getECBlock(timestamp);

        if (ecBlock == null) {
            return response.error(ApiErrors.UNKNOWN_VALUE, "blockId by timestamp", timestamp).build();
        }
        ECBlockDTO dto = new ECBlockDTO();
        dto.setId(ecBlock.getId());
        dto.setEcBlockId(String.valueOf(ecBlock.getId()));
        dto.setEcBlockId(Long.toUnsignedString(ecBlock.getId()));
        dto.setEcBlockHeight(ecBlock.getHeight());
        dto.setTimestamp(timestamp);
        log.trace("getECBlock result: {}", dto);
        return response.bind(dto).build();
    }

    @Inject public  BlockController(Blockchain blockchain, BlockConverter blockConverter,
                           FirstLastIndexParser indexParser, TimeService timeService);

}