declare namespace catalog {
  enum EAttributeKind {
    STORAGE = 'storage',
    RELATEDENTITY = 'relatedEntity',
    RELATEDENTITIES = 'relatedEntities',
    CALCULATED = 'calculated',
    COMPOSITION = 'composition',
    ALIAS = 'alias',
  }
  type AttributeType =
    | 'bool'
    | 'word'
    | 'time'
    | 'blob'
    | 'string'
    | 'text'
    | 'uuid'
    | 'short'
    | 'long'
    | 'number'
    | 'byte'
    | 'long64'
    | 'duration'
    | 'object'
    | 'date'
    | 'image';
  type Scope = 'public' | 'publicOnServer';
  type ApplyTo = 'dataClass' | 'entity' | 'entityCollection' | 'dataStore';
  type AttributeKind =
    | 'storage'
    | 'alias'
    | 'calculated'
    | 'relatedEntity'
    | 'relatedEntities';

  type IDataClassProperties = Partial<{
    panelColor: string;
    position: {
      x: number;
      y: number;
    };
  }>;
  type IAttributeProperties = Partial<{}>;
  interface IModelProperties extends Partial<{
    version: string;
    backgroundColor: string;
    backgroundImage: string;
    backgroundVariant: 'dotted' | 'grid' | 'none';
    viewport?: { zoom: number; x: number; y: number };
  }> {}
  interface IMethod {
    name: string;
    applyTo: ApplyTo;
    scope: Scope;
    from: 'remoteServer';
    allowedOnHTTPGET: boolean;
    startingLine: number;
    paramsText: string;
    filePath: string;
    userDefined: boolean;
    endingLine: number;
    exposed: boolean;
  }
  type IDataClass = {
    name: string;
    className: string;
    collectionName: string;
    scope: DataclassScope;
    attributes: IAttribute[];
    uuid?: string;
    virtual?: boolean;
  } & Partial<{
    defaultTopSize: number;
    leave_tag_on_delete: boolean;
    prevent_journaling: boolean;
    comment: string;
    extraProperties: IDataClassProperties;
  }>;
  type IEvent = {
    kind: string;
    from: string;
    userDefined: boolean;
  };
  export type AttributeIndexKind = 'btree' | 'cluster' | 'auto' | 'none';
  type IAttribute = {
    name: string;
    type: string;
    kind: AttributeKind;
    scope: Scope;
    uuid?: string;
  } & Partial<{
    indexKind?: AttributeIndexKind | null;
    invalidAlias: boolean;
    autogenerate: boolean;
    unique: boolean;
    primKey: boolean;
    exposed: boolean;
    behavior: string;
    autosequence: boolean;
    indexed: boolean;
    reversePath: boolean;
    keywordIndexed: boolean;
    not_null: boolean; // TODO: to be renamed to mandatory
    minValue: number;
    maxValue: number;
    simpleDate: boolean;
    defaultValue: any;
    events: any[];
    path: string;
    extraProperties: IAttributeProperties;
    styled_text: boolean;
    comment: string;
  }>;
}
