<commit_before>import * as moment from 'moment';
import * as numbro from 'numbro';
import { Dic } from './Globals';
import { ModifiableEntity, Entity, Lite, MListElement, ModelState, MixinEntity } from './Signum.Entities'; //ONLY TYPES or Cyclic problems in Webpack!
import { ajaxGet } from './Services';
import { MList } from "./Signum.Entities";
import QueryTokenBuilder from './SearchControl/QueryTokenBuilder';
import { AggregateType } from './FindOptions';

export function getEnumInfo(enumTypeName: string, enumId: number) {

  const ti = getTypeInfo(enumTypeName);

  if (!ti || ti.kind != "Enum")
    throw new Error(`${enumTypeName} is not an Enum`);

  return ti.membersById![enumId];
}

export interface TypeInfo {
  kind: KindOfType;
  name: string;
  fullName: string;
  niceName?: string;
  nicePluralName?: string;
  gender?: string;
  entityKind?: EntityKind;
  entityData?: EntityData;
  toStringFunction?: string;
  isLowPopulation?: boolean;
  isSystemVersioned?: boolean;
  requiresSaveOperation?: boolean;
  queryDefined?: boolean;
  requiresEntityPack?: boolean;
  members: { [name: string]: MemberInfo };
  membersById?: { [name: string]: MemberInfo };

  operations?: { [name: string]: OperationInfo };
}

export interface MemberInfo {
  name: string,
  niceName: string;
  typeNiceName: string;
  type: TypeReference;
  isReadOnly?: boolean;
  isIgnoredEnum?: boolean;
  unit?: string;
  format?: string;
  required?: boolean;
  maxLength?: number;
  isMultiline?: boolean;
  preserveOrder?: boolean;
  notVisible?: boolean;
  id?: any; //symbols
}

export interface OperationInfo {
  key: string,
  niceName: string;
  operationType: OperationType;
  canBeNew: boolean;
  canBeModified: boolean;
  hasCanExecute: boolean;
  hasStates: boolean;
}

export enum OperationType {
  Execute = "Execute" as any,
  Delete = "Delete" as any,
  Constructor = "Constructor" as any,
  ConstructorFrom = "ConstructorFrom" as any,
  ConstructorFromMany = "ConstructorFromMany" as any<commit_msg>fix OperationInfo<commit_after>import * as moment from 'moment';
import * as numbro from 'numbro';
import { Dic } from './Globals';
import { ModifiableEntity, Entity, Lite, MListElement, ModelState, MixinEntity } from './Signum.Entities'; //ONLY TYPES or Cyclic problems in Webpack!
import { ajaxGet } from './Services';
import { MList } from "./Signum.Entities";
import QueryTokenBuilder from './SearchControl/QueryTokenBuilder';
import { AggregateType } from './FindOptions';

export function getEnumInfo(enumTypeName: string, enumId: number) {

  const ti = getTypeInfo(enumTypeName);

  if (!ti || ti.kind != "Enum")
    throw new Error(`${enumTypeName} is not an Enum`);

  return ti.membersById![enumId];
}

export interface TypeInfo {
  kind: KindOfType;
  name: string;
  fullName: string;
  niceName?: string;
  nicePluralName?: string;
  gender?: string;
  entityKind?: EntityKind;
  entityData?: EntityData;
  toStringFunction?: string;
  isLowPopulation?: boolean;
  isSystemVersioned?: boolean;
  requiresSaveOperation?: boolean;
  queryDefined?: boolean;
  requiresEntityPack?: boolean;
  members: { [name: string]: MemberInfo };
  membersById?: { [name: string]: MemberInfo };

  operations?: { [name: string]: OperationInfo };
}

export interface MemberInfo {
  name: string,
  niceName: string;
  typeNiceName: string;
  type: TypeReference;
  isReadOnly?: boolean;
  isIgnoredEnum?: boolean;
  unit?: string;
  format?: string;
  required?: boolean;
  maxLength?: number;
  isMultiline?: boolean;
  preserveOrder?: boolean;
  notVisible?: boolean;
  id?: any; //symbols
}

export interface OperationInfo {
  key: string,
  niceName: string;
  operationType: OperationType;
  canBeNew?: boolean;
  canBeModified?: boolean;
  hasCanExecute?: boolean;
  hasStates?: boolean;
}

export enum OperationType {
  Execute = "Execute" as any,
  Delete = "Delete" as any,
  Constructor = "Constructor" as any,
  ConstructorFrom = "ConstructorFrom" as any,
  ConstructorFromMany = "ConstructorFromMany" as any
{'fraction_non_alphanumeric': 0.12083540527100944, 'fraction_numerical': 0.0, 'mean_word_length': 4.847383720930233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4534016', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1202, 'n_words': 366}