/**
* DevExtreme (ui/grid_core/ui.grid_core.data_source_adapter.d.ts)
* Version: 22.2.4 (build 23058-0308)
* Build date: Mon Feb 27 2023
*
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import DataSource from '../../data/data_source';
import { LoadOptions as BaseLoadOptions } from '../../data';
import { Controller, InternalGridOptions } from './ui.grid_core.modules';

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
 */
type RemoteOperations = Exclude<InternalGridOptions['remoteOperations'], 'auto' | boolean | undefined>;

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
 */
interface LoadOptions extends BaseLoadOptions {
  pageIndex?: number;
  pageSize?: number;
  groupExpand?: boolean;
}

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
 */
interface OperationTypes {
  filtering?: boolean;
  fullReload?: boolean;
  groupExpanding?: boolean;
  grouping?: boolean;
  pageIndex?: boolean;
  pageSize?: boolean;
  paging?: boolean;
  reload?: boolean;
  skip?: boolean;
  sorting?: boolean;
  take?: boolean;
}

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
 */
interface State {
  _cachedData: any;
  _cachedPagingData: any;
  _cachedStoreData: any;
  _currentTotalCount: any;
  _customLoadOptions: any;
  _dataIndexGetter: any;
  _dataSource: DataSource;
  _eventsStrategy: any;
  _hasLastPage: any;
  _isCustomLoading: any;
  _isLastPage: any;
  _isLoadingAll: any;
  _isRefreshed: any;
  _isRefreshing: any;
  _items: any;
  _lastLoadOptions: any;
  _lastOperationId: any;
  _lastOperationTypes: any;
  _loadingOperationTypes: any;
  _operationTypes: any;
  _optionCache: any;
  _remoteOperations: RemoteOperations;
  _scheduleLoadCallbacks: any;
  _totalCountCorrection: any;
  always: any;
  changed: any;
  changing: any;
  customizeStoreLoadOptions: any;
  loadError: any;
  loadingChanged: any;
  pushed: any;
  _dataChangedHandler: DataSourceAdapter['_handleDataChanged'];
  _customizeStoreLoadOptionsHandler: DataSourceAdapter['_handleCustomizeStoreLoadOptions'];
  _dataLoadedHandler: DataSourceAdapter['_handleDataLoaded'];
  _loadingChangedHandler: DataSourceAdapter['_handleLoadingChanged'];
  _loadErrorHandler: DataSourceAdapter['_handleLoadError'];
  _pushHandler: DataSourceAdapter['_handlePush'];
  _changingHandler: DataSourceAdapter['_handleChanging'];
}

/**
 * @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
 */
export interface DataSourceAdapter extends Omit<Controller, 'init' | 'dispose'>, Omit<DataSource, 'on' | 'off'>, State {
  init: (this: this, dataSource: DataSource, remoteOperations: RemoteOperations) => void;

  remoteOperations: (this: this) => RemoteOperations;

  dispose: (this: this, isSharedDataSource?: boolean) => void;

  refresh: (this: this, options, operationTypes) => any;

  resetCurrentTotalCount: (this: this) => any;

  resetCache: (this: this) => any;

  resetPagesCache: (this: this, isLiveUpdate?) => any;

  _needClearStoreDataCache: (this: this) => any;

  push: (this: this, changes, fromStore) => any;

  getDataIndexGetter: (this: this) => any;

  _getKeyInfo: (this: this) => any;

  _needToCopyDataObject: () => any;

  _applyBatch: (this: this, changes, fromStore?) => any;

  _handlePush: (this: this, { changes }) => any;

  _handleChanging: (this: this, e) => any;

  _needCleanCacheByOperation: (this: this, operationType, remoteOperations: RemoteOperations) => any;

  _customizeRemoteOperations: (this: this, options, operationTypes) => any;

  _handleCustomizeStoreLoadOptions: (this: this, options) => any;

  _handleDataLoading: (this: this, options) => any;

  _handleDataLoadingCore: (this: this, options) => any;

  _handleDataLoaded: (this: this, options) => any;

  _handleDataLoadedCore: (this: this, options) => any;

  _handleLoadingChanged: (this: this, isLoading) => any;

  _handleLoadError: (this: this, error) => any;

  _loadPageSize: (this: this) => any;

  _handleDataChanged: (this: this, args) => any;

  _scheduleCustomLoadCallbacks: (this: this, deferred) => any;

  loadingOperationTypes: (this: this) => any;

  operationTypes: (this: this) => OperationTypes;

  lastLoadOptions: (this: this) => any;

  isLastPage: (this: this) => any;

  _dataSourceTotalCount: (this: this) => any;

  totalCount: (this: this) => any;

  totalCountCorrection: (this: this) => any;

  itemsCount: (this: this) => any;

  totalItemsCount: (this: this) => any;

  pageSize: (this: this) => any;

  pageCount: (this: this) => number;

  hasKnownLastPage: (this: this) => any;

  loadFromStore: (this: this, loadOptions, store?) => any;

  isCustomLoading: (this: this) => any;

  load: (this: this, options?: any) => any;

  reload: (this: this, full?) => any;

  getCachedStoreData: (this: this) => any;

}
