class TripDatabaseAdapter implements DatabaseAdapter<Trip> {

    @Override
    @NonNull
    public Trip read(@NonNull Cursor cursor) {
        final int idIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_ID);
        final int uuidIndex = cursor.getColumnIndex(CategoriesTable.COLUMN_UUID);
        final int nameIndex = cursor.getColumnIndex(TripsTable.COLUMN_NAME);
        final int fromIndex = cursor.getColumnIndex(TripsTable.COLUMN_FROM);
        final int toIndex = cursor.getColumnIndex(TripsTable.COLUMN_TO);
        final int fromTimeZoneIndex = cursor.getColumnIndex(TripsTable.COLUMN_FROM_TIMEZONE);
        final int toTimeZoneIndex = cursor.getColumnIndex(TripsTable.COLUMN_TO_TIMEZONE);
        final int commentIndex = cursor.getColumnIndex(TripsTable.COLUMN_COMMENT);
        final int costCenterIndex = cursor.getColumnIndex(TripsTable.COLUMN_COST_CENTER);
        final int defaultCurrencyIndex = cursor.getColumnIndex(TripsTable.COLUMN_DEFAULT_CURRENCY);
        final int nameHiddenFromAutoCompleteIndex = cursor.getColumnIndex(TripsTable.COLUMN_NAME_HIDDEN_AUTO_COMPLETE);
        final int commentHiddenFromAutoCompleteIndex = cursor.getColumnIndex(TripsTable.COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE);
        final int costCenterHiddenFromAutoCompleteIndex = cursor.getColumnIndex(TripsTable.COLUMN_COSTCENTER_HIDDEN_AUTO_COMPLETE);

        final int id = cursor.getInt(idIndex);
        final UUID uuid = UUID.fromString(cursor.getString(uuidIndex));
        final String name = cursor.getString(nameIndex);
        final long from = cursor.getLong(fromIndex);
        final long to = cursor.getLong(toIndex);
        final String fromTimeZone = cursor.getString(fromTimeZoneIndex);
        final String toTimeZone = cursor.getString(toTimeZoneIndex);
        final String comment = cursor.getString(commentIndex);
        final String costCenter = cursor.getString(costCenterIndex);
        final String defaultCurrency = cursor.getString(defaultCurrencyIndex);
        final boolean isNameHiddenFromAutoComplete = cursor.getInt(nameHiddenFromAutoCompleteIndex) > 0;
        final boolean isCommentHiddenFromAutoComplete = cursor.getInt(commentHiddenFromAutoCompleteIndex) > 0;
        final boolean isCostCenterHiddenFromAutoComplete = cursor.getInt(costCenterHiddenFromAutoCompleteIndex) > 0;
        final SyncState syncState = syncStateAdapter.read(cursor);

        return new TripBuilderFactory()
                .setId(id)
                .setUuid(uuid)
                .setDirectory(storageManager.mkdir(name))
                .setStartDate(from)
                .setEndDate(to)
                .setStartTimeZone(fromTimeZone)
                .setEndTimeZone(toTimeZone)
                .setComment(comment)
                .setCostCenter(costCenter)
                .setDefaultCurrency(defaultCurrency, preferences.get(UserPreference.General.DefaultCurrency))
                .setNameHiddenFromAutoComplete(isNameHiddenFromAutoComplete)
                .setCommentHiddenFromAutoComplete(isCommentHiddenFromAutoComplete)
                .setCostCenterHiddenFromAutoComplete(isCostCenterHiddenFromAutoComplete)
                .setSyncState(syncState)
                .build();
    }

    public  TripDatabaseAdapter(@NonNull StorageManager storageManager, @NonNull UserPreferenceManager preferences, @NonNull SyncStateAdapter syncStateAdapter);

}