///////////////////////////////////////////////////
// This file is generated by build-interfaces.js //
///////////////////////////////////////////////////

import {
  LaraJoinPoint,
  registerJoinpointMapper,
  wrapJoinPoint,
  unwrapJoinPoint,
} from "@specs-feup/lara/api/LaraJoinPoint.js";

type PrivateMapper = {
  "Joinpoint": typeof Joinpoint,
  "FileJp": typeof FileJp,
  "Program": typeof Program,
  "Statement": typeof Statement,
};

type DefaultAttributeMap = {
  FileJp: "name",
}

export class Joinpoint extends LaraJoinPoint {
  /**
   * @internal
   */
  static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = {
    name: null,
  };
  /**
   * String with the code represented by this node
   */
  get code(): string { return wrapJoinPoint(this._javaObject.getCode()) }
  /**
   * Returns the parent node in the AST, or undefined if it is the root node
   */
  get parent(): Joinpoint { return wrapJoinPoint(this._javaObject.getParent()) }
  /**
   * Returns the 'program' join point
   */
  get root(): Program { return wrapJoinPoint(this._javaObject.getRoot()) }
  /**
   * Replaces this node with the given node
   */
  replaceWith(node: Joinpoint): Joinpoint { return wrapJoinPoint(this._javaObject.replaceWith(unwrapJoinPoint(node))); }
}

  /**
   * Represents a source file (e.g., .f90)
   */
export class FileJp extends Joinpoint {
  /**
   * @internal
   */
  static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = {
    name: "name",
  };
  /**
   * The name of the file
   */
  get name(): string { return wrapJoinPoint(this._javaObject.getName()) }
}

  /**
   * Represents the complete program and is the top-most join point in the hierarchy
   */
export class Program extends Joinpoint {
  /**
   * @internal
   */
  static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = {
    name: null,
  };
}

  /**
   * Represents a Fortran statement
   */
export class Statement extends Joinpoint {
  /**
   * @internal
   */
  static readonly _defaultAttributeInfo: {readonly map?: DefaultAttributeMap, readonly name: string | null, readonly type?: PrivateMapper, readonly jpMapper?: typeof JoinpointMapper} = {
    name: null,
  };
  get isFirst(): boolean { return wrapJoinPoint(this._javaObject.getIsFirst()) }
  get isLast(): boolean { return wrapJoinPoint(this._javaObject.getIsLast()) }
}

const JoinpointMapper = {
  joinpoint: Joinpoint,
  file: FileJp,
  program: Program,
  statement: Statement,
};

let registered = false;
if (!registered) {
  registerJoinpointMapper(JoinpointMapper);
  registered = true;
}

