export interface RpcError {
  type: 'UNAUTHORIZED' | 'VALIDATION_ERROR' | 'NOT_FOUND' | 'INTERNAL_ERROR' | 'FORBIDDEN' | 'RATE_LIMITED' | string;
  message: string;
  code?: number;
}

export interface RpcResponse<T = unknown, Extensions = unknown> {
  datetime: number;
  success: boolean;
  result: T | null;
  extensions: Extensions | null;
  error: RpcError | null;
}

export type AccessButtonsType = {
  showSaveButton?: boolean,
  showCreateButton?: boolean,
  showDeleteButton?: boolean,
  showActionButton?: boolean,
  showRelationButton?: boolean,
  showCloneButton?: boolean,
  showCopyButton?: boolean
};
export type ActionMSEnum = "sendMessage" | "makeCall";
export type ActionNSTVType = {
  name?: /** Имя действия */ string,
  type?: /** Тип */ string,
  value?: /** Значение */ string,
  text?: /** Текст кнопки */ string,
  style?: /** Стиль */ StyleDPEnum,
  uuid?: string
};
export type ActionPositionISTEnum = "sidebar" | "inline" | "table";
export type AdminActionItemType = {
  args?: StructureType,
  key?: string,
  title?: string,
  icon?: string,
  multiSelect?: boolean
};
export type AdminActionMenuItemType = {
  key?: string,
  title?: string,
  icon?: string
};
export type AdminInitType = {
  langs?: LangsBDEFHIJPRZEnum[],
  auth?: AuthEPSType,
  title?: string,
  icon?: string,
  cover?: string,
  color?: string,
  subtitle?: string,
  terms?: string,
  privacy?: string
};
export type AllFieldsEnum = "static" | "fileAudio" | "fileDocumentLink" | "fileDocument" | "fileImageID" | "fileVideoID" | "fileAudioID" | "fileAudioLink" | "fileDocumentID" | "fileImageLink" | "fileImage" | "fileVideo" | "enum" | "enums" | "string" | "structure" | "color" | "unixdatetime" | "mixed" | "bool" | "float" | "int" | "markdown" | "viz" | "selfRef" | "uuid" | "url" | "text" | "html" | "time" | "range" | "IDs" | "geopoint" | "array" | "phone" | "ID" | "code" | "unixdate" | "mongoPoint" | "adminGroup" | "dashboard" | "admin" | "login" | "password" | "email" | "mongoPolygon" | "rate" | "gradient" | "report" | "geoRegion" | "balance" | "json" | "hall" | "hallSelector";
export type AllItemGIKTType = {
  key?: string,
  icon?: string,
  title?: string,
  group?: string
};
export type ApikeyACITType = {
  _id?: string,
  apikey?: string,
  title?: string,
  last_used?: number,
  created_at?: number
};
export type AppleIMUInput = {
  identityToken: string,
  user: string,
  [key: string]: any
};
export type ArgsAllActionsInput = {
  collection: string,
  _ids: string[]
};
export type ArgsAuthEmailInput = {
  withEmailCode?: boolean,
  code?: number,
  login: string,
  password?: string,
  deviceInfo?: DeviceInfoMNPUInput
};
export type ArgsAuthEmailPrepareInput = {
  login: string
};
export type ArgsAuthEmailSetInput = {
  email: string,
  code?: number
};
export type ArgsAuthPhoneInput = {
  phone: string,
  code_id?: string,
  deviceInfo?: DeviceInfoMNPUInput
};
export type ArgsAuthPhoneSetInput = {
  phone: string,
  code_id?: string
};
export type ArgsAuthSocInput = {
  unsetId?: string,
  set?: boolean,
  key?: string,
  deviceInfo?: DeviceInfoMNPUInput,
  timezone?: string,
  apple?: AppleIMUInput
};
export type ArgsBaseInput = {
  url: string
};
export type ArgsChangePasswordInput = {
  currentPassword?: string,
  newPassword?: string
};
export type ArgsCollectionAccessInput = {
  collection: string,
  ids?: string[]
};
export type ArgsCollectionChannelsInput = {
  collection: string,
  ids: string[]
};
export type ArgsCollectionInput = {
  collection: string
};
export type ArgsCollectionRelationsInput = {
  collection: string,
  ids?: string[]
};
export type ArgsDataInput = {
  _id?: string,
  table?: boolean,
  collection: string,
  limit?: number,
  offset?: number,
  search?: string,
  sort?: SortDFInput,
  filter?: any,
  pipeline?: any,
  onlyHash?: boolean
};
export type ArgsDataSocialsInput = {
  _id?: string,
  collection: string
};
export type ArgsDataVizInput = {
  viz: string,
  collection: string,
  search?: string,
  filter?: any,
  pipeline?: any
};
export type ArgsDeleteDataInput = {
  _ids?: string[],
  collection: string
};
export type ArgsDeleteExportInput = {
  _id?: string
};
export type ArgsDisplayValuesInput = {
  collection: string,
  ids?: string[],
  limit?: number,
  offset?: number,
  search?: string,
  filter?: any
};
export type ArgsEmptyDataInput = {
  clone?: string,
  collection: string
};
export type ArgsFilterInput = {
  collection: string
};
export type ArgsGeneratePaymentLinkInput = {
  currency: string,
  gateway: string,
  amount: number
};
export type ArgsGeocodeInput = {
  byCoords?: ByCoordLInput,
  byString?: ByStringLSInput
};
export type ArgsGeolocationInput = {
  ip?: string
};
export type ArgsHallElementsInput = {
  hallUUID: string
};
export type ArgsLastBalanceOperationsInput = {
  type: TypeAIOEnum
};
export type ArgsLocalizationsInput = {
  texts?: LocalizationItemInput[],
  targetLang?: TargetLangBDEFHIJPRZEnum
};
export type ArgsMakeExportInput = {
  ids?: string[],
  title?: string,
  collection: string,
  filter?: any,
  pipeline?: any
};
export type ArgsMakeStatementExportInput = {
  currency: string,
  range?: RangeFTInput
};
export type ArgsMoveUpdateInput = {
  _id?: string,
  collection?: string,
  aboveId?: string,
  belowId?: string
};
export type ArgsPrepareActionInput = {
  collection: string,
  _ids?: string[],
  action: string
};
export type ArgsRemoveApiKeyInput = {
  _id?: string
};
export type ArgsRunActionInput = {
  collection: string,
  _ids?: string[],
  action: string,
  values?: any
};
export type ArgsStagesTotalInput = {
  collection: string,
  search?: string,
  filter?: any
};
export type ArgsUpdateInput = {
  _ids?: string[],
  collection: string,
  values?: any
};
export type AssetCIPTType = {
  icon?: string,
  cover?: string,
  color?: string,
  subtitle?: string,
  terms?: string,
  privacy?: string
};
export type AuthEPSType = {
  emailLogin?: boolean,
  phoneLogin?: boolean,
  socialLogin?: boolean,
  emailReg?: boolean,
  phoneReg?: boolean,
  socialReg?: boolean
};
export type AuthEmailPrepareCFIType = {
  find?: boolean,
  isEmail?: boolean,
  canRegister?: boolean
};
export type AuthSocSTUType = {
  token?: string,
  unsetResult?: boolean,
  setResult?: boolean
};
export type BadgesType = {
  [key: string]: any
};
export type BalanceFPType = {
  field?: StructureType,
  path?: string
};
export type BalancePaymentType = {
  _id?: string,
  amount?: number,
  currency?: string,
  description?: string,
  created_at?: number,
  beforeBalance?: number,
  afterBalance?: number
};
export type BoardFilterPresetFKTType = {
  key?: string,
  title?: string,
  filter?: any
};
export type ByCoordLInput = {
  latitude?: number,
  longitude?: number
};
export type ByStringLSInput = {
  string?: string,
  latutude?: number,
  longitude?: number
};
export type CollectionAccessType = {
  canCreate?: boolean,
  canUpdate?: boolean,
  canDelete?: boolean,
  canExport?: boolean,
  buttons?: AccessButtonsType
};
export type CollectionCSType = {
  structureData?: StructureDatumMSType,
  collectionMenu?: CollectionMenuAMType
};
export type CollectionMenuAMType = {
  menu?: MenuCGITType[],
  allItems?: AllItemGIKTType[]
};
export type CollectionRelationType = {
  icon?: string,
  title?: string,
  subtitle?: string,
  collection?: string,
  key?: string
};
export type CompositeTypeGHType = {
  geoPoint?: GeopointType,
  geoRegion?: GeoRegionGType[],
  gradient?: GradientAPType,
  hallElements?: HallElementType
};
export type DashboardBlockTypeBCLPEnum = "card" | "lineChart" | "pieChart" | "barChart";
export type DatumDHLTType = {
  data?: DatumIMType[],
  limit?: number,
  hash?: string,
  offset?: number,
  total?: number
};
export type DatumDIType = {
  _id?: string,
  displayValue?: string
};
export type DatumIMType = {
  _id?: string,
  [key: string]: any
};
export type DeviceInfoMNPUInput = {
  name?: string,
  model?: string,
  platform?: string,
  uuid?: string
};
export type DirectionADEnum = "ASC" | "DESC";
export type DisplayValueDLOTType = {
  data?: DatumDIType[],
  limit?: number,
  offset?: number,
  total?: number
};
export type EmptyDatumIMType = {
  _id?: string,
  [key: string]: any
};
export type FileAudioFileType = {
  _id?: string,
  fileType?: string,
  name?: string,
  url?: string,
  duration?: number,
  type?: string,
  created_at?: string
};
export type FileDocumentFileType = {
  _id?: string,
  fileType?: string,
  name?: string,
  url?: string,
  type?: string,
  created_at?: string
};
export type FileImageFileType = {
  _id?: string,
  fileType?: string,
  name?: string,
  url?: string,
  url_medium?: string,
  url_small?: string,
  blurhash?: string,
  width?: number,
  height?: number,
  type?: string,
  created_at?: number
};
export type FileVideoFileType = {
  _id?: string,
  fileType?: string,
  name?: string,
  url?: string,
  cover?: string,
  duration?: number,
  width?: number,
  height?: number,
  type?: string,
  created_at?: number
};
export type FilterPresetFKTType = {
  key?: string,
  title?: string,
  filter?: any
};
export type GatewayCDKTType = {
  minAmount?: number,
  maxAmount?: number,
  title?: string,
  currency?: string,
  description?: string,
  icon?: string,
  key?: string
};
export type GeoRegionGType = {
  geometry?: MongoPolygonType
};
export type GeolocationILType = {
  latitude?: number,
  longitude?: number,
  ip?: string
};
export type GeopointType = {
  uuid?: string,
  /**
   * @deprecated Use "name" instead
   */
  address?: string,
  name?: string,
  context?: string,
  meta?: MetumACFPType,
  grid?: string,
  lat?: number,
  lng?: number,
  location?: MongoPointType
};
export type GradientAPType = {
  palette?: PaletteCOType[],
  angle?: number
};
export type GroupIKTType = {
  key?: string,
  icon?: string,
  title?: string
};
export type GroupMType = {
  [key: string]: any
};
export type HallElementType = {
  hallUUID?: string,
  x: number,
  y: number,
  width?: number,
  height?: number,
  rotation?: number,
  label?: string,
  points?: number[],
  type?: TypeCSTWZEnum,
  seat?: SeatNRType,
  sector?: string,
  _id?: string,
  created_at?: number,
  updated_at?: number
};
export type HallSelectorElementType = {
  hallElement?: string,
  price?: number,
  color?: string
};
export type ItemMType = {
  [key: string]: StructureType
};
export type JoinableMemberIOUType = {
  owner?: string,
  ownerCollection?: string,
  isAdmin?: boolean,
  uuid?: string
};
export type LangsBDEFHIJPRZEnum = "ru" | "en" | "de" | "fr" | "it" | "es" | "pt" | "hi" | "bn" | "id" | "zh" | "ja";
export type LocalizationItemInput = {
  md5?: string,
  text?: string
};
export type LocalizationItemType = {
  md5?: string,
  text?: string
};
export type MemberIOUType = {
  owner?: string,
  ownerCollection?: string,
  isAdmin?: boolean,
  uuid?: string
};
export type MenuABMType = {
  menu?: MenuItemType[],
  allItems?: MenuItemType[],
  badges?: BadgesType
};
export type MenuCGITType = {
  key?: string,
  icon?: string,
  title?: string,
  group?: string,
  children?: childGIKTType[]
};
export type MenuItemChildType = {
  label?: string,
  icon?: string,
  key?: string,
  collection?: string,
  single?: boolean
};
export type MenuItemType = {
  label?: string,
  icon?: string,
  key?: string,
  collection?: string,
  single?: boolean,
  children?: MenuItemChildType[]
};
export type MetumACFPType = {
  label?: string,
  floor?: string,
  entrance?: string,
  apartment?: string,
  comment?: string,
  phone?: number
};
export type MongoPointType = {
  type?: string,
  coordinates?: number[]
};
export type MongoPolygonType = {
  type?: "Polygon",
  coordinates?: number[][][]
};
export type NavigateOPTEnum = "tCompany" | "tCompanyBank" | "profile" | "openLink";
export type PaletteCOType = {
  color?: string,
  opacity?: number,
  offset?: string
};
export type PayloadMType = {
  [key: string]: any
};
export type PayloadUType = {
  url?: string
};
export type PinnedETUType = {
  enabled?: /** Закреплено */ boolean,
  user?: /** Кто закрепил */ string,
  timestamp?: /** Когда закреплено */ number
};
export type ProfileABCSType = {
  structure?: StructureType,
  data?: any,
  changePassword?: boolean,
  subAccount?: boolean,
  alerts?: ProfileAlertType[],
  balances?: BalanceFPType[]
};
export type ProfileAlertType = {
  type?: TypeEISWEnum,
  title?: string,
  message?: string,
  navigate?: NavigateOPTEnum,
  link?: string
};
export type RangeFTInput = {
  from?: number,
  to?: number
};
export type ReactionCTUType = {
  user?: string,
  type?: TypeACFHLPSWEnum,
  created_at?: /** Когда поставлена */ number,
  uuid?: string
};
export type ReferenceDUType = {
  documentId?: string,
  documentCollection?: string,
  uuid?: string
};
export type RunActionPType = {
  payload?: PayloadUType
};
export type SeatNRType = {
  number?: string,
  row?: string
};
export type ShmChannelMessageType = {
  channel?: string,
  clientMessageId?: string,
  owner?: string,
  ownerCollection?: string,
  text?: /** Текст сообщения */ string,
  type?: /** Тип сообщения */ TypeRSEnum,
  attachments?: /** Вложения */ FileDocumentFileType[],
  reply?: string,
  voice?: FileAudioFileType,
  actions?: /** Кнопки */ ActionNSTVType[],
  reactions?: /** Реакции */ ReactionCTUType[],
  pinned?: PinnedETUType,
  payload?: PayloadMType,
  viewed?: /** Прочитано */ boolean,
  deleted?: /** Кто удалил */ string,
  _id?: string,
  created_at?: number,
  updated_at?: number
};
export type ShmChannelType = {
  space?: string,
  name?: string,
  lastMessage?: string,
  payload?: PayloadMType,
  reference?: ReferenceDUType[],
  members?: MemberIOUType[],
  joinableMembers?: JoinableMemberIOUType[],
  closed?: boolean,
  unreadCounts?: UnreadCountMType,
  pinnedMessageId?: string,
  _id?: string,
  created_at?: number,
  updated_at?: number
};
export type ShmExportType = {
  type?: TypeDSEnum,
  fileName?: string,
  fileUrl?: string,
  timezone?: string,
  title?: string,
  currency?: string,
  collection?: string,
  pipeline?: any,
  progress?: number,
  error?: string,
  status?: StatusDEPEnum,
  _id?: string,
  created_at?: number,
  updated_at?: number
};
export type ShmMsgAuthLinkType = {
  title?: string,
  action?: ActionMSEnum,
  contact?: string,
  link?: string,
  image?: string,
  color?: string
};
export type ShmMsgAuthType = {
  auth?: boolean,
  token?: string,
  code?: number,
  qrLink?: string,
  code_id?: string,
  links?: ShmMsgAuthLinkType[],
  otherLinks?: ShmMsgAuthLinkType[]
};
export type ShmMsgSetType = {
  auth?: boolean,
  token?: string,
  code?: number,
  qrLink?: string,
  code_id?: string,
  links?: ShmMsgAuthLinkType[],
  otherLinks?: ShmMsgAuthLinkType[]
};
export type ShmSocialType = {
  id?: string,
  profile_id?: any,
  type?: string,
  soc?: string,
  mail?: string,
  name?: string,
  surname?: string,
  photo?: string,
  gender?: string,
  groups?: GroupMType,
  _id?: string,
  created_at?: number,
  updated_at?: number
};
export type SortDFInput = {
  direction?: DirectionADEnum,
  field?: string
};
export type StagesTotalMType = {
  [key: string]: number
};
export type StatusDEPEnum = "pending" | "processing" | "done" | "error";
export type StructureDatumMSType = {
  mainStructure?: StructureType,
  subStructure?: StructureType
};
export type StructureType = {
  collection?: string,
  key?: string,
  itemType?: StructureType,
  codeLang?: string,
  manualSort?: boolean,
  filterPresets?: FilterPresetFKTType[],
  boardFilterPresets?: BoardFilterPresetFKTType[],
  args?: StructureType,
  actionPosition?: ActionPositionISTEnum,
  filterType?: StructureType,
  items?: ItemMType,
  columnsWidth?: number,
  values?: ValueMType,
  haveCalculateFunction?: boolean,
  dashboardBlockType?: DashboardBlockTypeBCLPEnum,
  gateways?: GatewayCDKTType[],
  apikey?: boolean,
  tablePriority?: number,
  unique?: boolean,
  hallSelectorReverse?: boolean,
  hallSelectorHallUUID?: string,
  hallSelectorElements?: HallSelectorElementType[],
  report?: boolean,
  globalUnique?: boolean,
  display?: boolean,
  displayPrefix?: string,
  trim?: boolean,
  uppercase?: boolean,
  currency?: string,
  currencySymbol?: string,
  accept?: string,
  hide?: boolean,
  single?: boolean,
  min?: number,
  max?: number,
  editable?: boolean,
  inAdmin?: boolean,
  inTable?: boolean,
  col?: number,
  row?: number,
  required?: boolean,
  nullable?: boolean,
  default?: any,
  title?: string,
  description?: string,
  type?: AllFieldsEnum,
  cond?: any,
  localCond?: any,
  defaultIsSet?: boolean,
  palette?: string[],
  assets?: AssetCIPTType,
  group?: GroupIKTType
};
export type StyleDPEnum = "default" | "primary" | "danger";
export type TargetLangBDEFHIJPRZEnum = "ru" | "en" | "de" | "fr" | "it" | "es" | "pt" | "hi" | "bn" | "id" | "zh" | "ja";
export type TypeACFHLPSWEnum = "heart" | "like" | "laugh" | "wow" | "sad" | "angry" | "clap" | "party" | "poop" | "fire";
export type TypeAIOEnum = "all" | "out" | "in";
export type TypeCSTWZEnum = "seat" | "sector" | "table" | "stage" | "wall" | "zone" | "sector_polygon" | "canvas";
export type TypeDSEnum = "statement" | "data";
export type TypeEISWEnum = "error" | "warning" | "info" | "success";
export type TypeRSEnum = "regular" | "system";
export type UnreadCountMType = {
  [key: string]: number
};
export type UpdateDType = {
  data?: DatumIMType[]
};
export type ValueMType = {
  [key: string]: string
};
export type VizBarChartDataType = {
  items?: VizBarChartType[]
};
export type VizBarChartType = {
  label?: string,
  value?: number
};
export type VizCardType = {
  value?: number
};
export type VizDataType = {
  vizCard?: VizCardType,
  vizLineChart?: VizLineChartDataType,
  vizBarChart?: VizBarChartDataType,
  vizPieChart?: VizPieChartDataType,
  vizRadarChart?: VizRadarChartDataType,
  vizRFM?: VizRFMDataType
};
export type VizLineChartDataType = {
  items?: VizLineChartType[]
};
export type VizLineChartType = {
  label?: string,
  value?: number
};
export type VizPieChartDataType = {
  items?: VizPieChartType[]
};
export type VizPieChartType = {
  label?: string,
  value?: number
};
export type VizRFMCalulatedRangeFrequencyType = {
  min?: number,
  max?: number
};
export type VizRFMCalulatedRangeMonetaryType = {
  min?: number,
  max?: number
};
export type VizRFMCalulatedRangeRecencyType = {
  min?: number,
  max?: number
};
export type VizRFMCalulatedRangesType = {
  r?: VizRFMCalulatedRangeRecencyType,
  f?: VizRFMCalulatedRangeFrequencyType,
  m?: VizRFMCalulatedRangeMonetaryType
};
export type VizRFMDataType = {
  ranges?: VizRFMCalulatedRangesType,
  items?: VizRFMType[]
};
export type VizRFMType = {
  r?: number,
  f?: number,
  m?: number,
  segment?: string,
  count?: number
};
export type VizRadarChartDataType = {
  items?: VizRadarChartType[]
};
export type VizRadarChartType = {
  label?: string,
  value?: number
};
export type childGIKTType = {
  key?: string,
  icon?: string,
  title?: string,
  group?: string
};