class SyncStateAdapter {

    @NonNull
    public SyncState read(@NonNull Cursor cursor) {
        final int driveIdentifierIndex = cursor.getColumnIndex(AbstractSqlTable.COLUMN_DRIVE_SYNC_ID);
        final int driveIsSyncedIndex = cursor.getColumnIndex(AbstractSqlTable.COLUMN_DRIVE_IS_SYNCED);
        final int driveMarkedForDeletionIndex = cursor.getColumnIndex(AbstractSqlTable.COLUMN_DRIVE_MARKED_FOR_DELETION);
        final int lastLocalModificationTimeIndex = cursor.getColumnIndex(AbstractSqlTable.COLUMN_LAST_LOCAL_MODIFICATION_TIME);

        final String driveIdentifierString = cursor.getString(driveIdentifierIndex);
        final boolean driveIsSynced = cursor.getInt(driveIsSyncedIndex) > 0;
        final boolean driveMarkedForDeletion = cursor.getInt(driveMarkedForDeletionIndex) > 0;
        final long lastLocalModificationTimeLong = cursor.getLong(lastLocalModificationTimeIndex);

        final Date lastLocalModificationTime = new Date(lastLocalModificationTimeLong);

        final IdentifierMap identifierMap;
        if (driveIdentifierString != null) {
            final Identifier driveIdentifier = new Identifier(driveIdentifierString);
            identifierMap = new IdentifierMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIdentifier));
        } else {
            identifierMap = null;
        }
        final SyncStatusMap syncStatusMap = new SyncStatusMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveIsSynced));
        final MarkedForDeletionMap markedForDeletionMap = new MarkedForDeletionMap(Collections.singletonMap(SyncProvider.GoogleDrive, driveMarkedForDeletion));
        return new DefaultSyncState(identifierMap, syncStatusMap, markedForDeletionMap, lastLocalModificationTime);
    }

    @Inject public  SyncStateAdapter();

}