class TimestampingServiceDiagnosticConverter {

    public TimestampingServiceDiagnostics convert(DiagnosticsStatus diagnosticsStatus) {
        TimestampingServiceDiagnostics timestampingServiceDiagnostics = new TimestampingServiceDiagnostics();
        timestampingServiceDiagnostics.setUrl(diagnosticsStatus.getDescription());
        Optional<TimestampingStatus> statusCode = TimestampingStatusMapping.map(
                diagnosticsStatus.getReturnCode());
        timestampingServiceDiagnostics.setStatusCode(statusCode.orElse(null));
        Optional<DiagnosticStatusClass> statusClass = DiagnosticStatusClassMapping.map(
                diagnosticsStatus.getReturnCode());
        timestampingServiceDiagnostics.setStatusClass(statusClass.orElse(null));
        if (diagnosticsStatus.getPrevUpdate() != null) {
            timestampingServiceDiagnostics.setPrevUpdateAt(diagnosticsStatus.getPrevUpdate());
        }

        return timestampingServiceDiagnostics;
    }

}