import { HttpError } from '@bcs/sdk/lib/sdk-core/models';
import { ApiResource } from '@bcs/sdk/lib/sdk-core/monads/api-resource';
import {
  AnyActionWithPayload,
  AsyncConstant,
} from '@bcs/sdk/lib/sdk-core/persistence';
import { RemoteData } from '@devexperts/remote-data-ts';

export interface IOwnStore {
  bankSigners: RemoteData<HttpError<string>, ApiResource<ISignerInfo[]>>;
  sentStatus: RemoteData<HttpError<string>, ApiResource<string>>;
}
export interface ISuffixesOptions {
  actionSuffixes: AsyncConstant;
}
export interface IBankSignerModuleActions {
  getBankSignersConst: AsyncConstant;
  getBankSignersAction: <T>(payload: T) => AnyActionWithPayload<T>;
  postBankSignersConst: AsyncConstant;
  postBankSignersAction: <T>(payload: T) => AnyActionWithPayload<T>;
}

export type Permissions = 'getBankSigners' | 'postBankSigners';
export type StorageKeys = 'jwt';
export interface IApiEntities extends Record<string, (...args: unknown[]) => unknown> {
  signersList: () => ISignerInfo[];
  remoteService: (selectedBankSigner: ISignerInfo) => IResponseType;
}

export type Routes = 'main';
export interface ISignerInfo {
  signerId?: string;
  repDocId?: string;
  docInfo?: string;
  isDefault?: boolean;
}
export interface IResponseType {
  serviceId: string;
  status: string;
}
