/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.3.0
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.chilkatsoft;

public class CkJs {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected CkJs(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(CkJs obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected static long swigRelease(CkJs obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

  @SuppressWarnings({"deprecation", "removal"})
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        chilkatJNI.delete_CkJs(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CkJs() {
    this(chilkatJNI.new_CkJs(), true);
  }

  public void LastErrorXml(CkString str) {
    chilkatJNI.CkJs_LastErrorXml(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public void LastErrorHtml(CkString str) {
    chilkatJNI.CkJs_LastErrorHtml(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public void LastErrorText(CkString str) {
    chilkatJNI.CkJs_LastErrorText(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public void put_EventCallbackObject(CkBaseProgress progress) {
    chilkatJNI.CkJs_put_EventCallbackObject(swigCPtr, this, CkBaseProgress.getCPtr(progress), progress);
  }

  public void get_DebugLogFilePath(CkString str) {
    chilkatJNI.CkJs_get_DebugLogFilePath(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public String debugLogFilePath() {
    return chilkatJNI.CkJs_debugLogFilePath(swigCPtr, this);
  }

  public void put_DebugLogFilePath(String newVal) {
    chilkatJNI.CkJs_put_DebugLogFilePath(swigCPtr, this, newVal);
  }

  public void get_LastErrorHtml(CkString str) {
    chilkatJNI.CkJs_get_LastErrorHtml(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public String lastErrorHtml() {
    return chilkatJNI.CkJs_lastErrorHtml(swigCPtr, this);
  }

  public void get_LastErrorText(CkString str) {
    chilkatJNI.CkJs_get_LastErrorText(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public String lastErrorText() {
    return chilkatJNI.CkJs_lastErrorText(swigCPtr, this);
  }

  public void get_LastErrorXml(CkString str) {
    chilkatJNI.CkJs_get_LastErrorXml(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public String lastErrorXml() {
    return chilkatJNI.CkJs_lastErrorXml(swigCPtr, this);
  }

  public boolean get_LastMethodSuccess() {
    return chilkatJNI.CkJs_get_LastMethodSuccess(swigCPtr, this);
  }

  public void put_LastMethodSuccess(boolean newVal) {
    chilkatJNI.CkJs_put_LastMethodSuccess(swigCPtr, this, newVal);
  }

  public int get_TimeoutSeconds() {
    return chilkatJNI.CkJs_get_TimeoutSeconds(swigCPtr, this);
  }

  public void put_TimeoutSeconds(int newVal) {
    chilkatJNI.CkJs_put_TimeoutSeconds(swigCPtr, this, newVal);
  }

  public boolean get_VerboseLogging() {
    return chilkatJNI.CkJs_get_VerboseLogging(swigCPtr, this);
  }

  public void put_VerboseLogging(boolean newVal) {
    chilkatJNI.CkJs_put_VerboseLogging(swigCPtr, this, newVal);
  }

  public void get_Version(CkString str) {
    chilkatJNI.CkJs_get_Version(swigCPtr, this, CkString.getCPtr(str), str);
  }

  public String version() {
    return chilkatJNI.CkJs_version(swigCPtr, this);
  }

  public boolean CallFunction(CkJsonObject funcJson, CkJsonObject resultJson) {
    return chilkatJNI.CkJs_CallFunction(swigCPtr, this, CkJsonObject.getCPtr(funcJson), funcJson, CkJsonObject.getCPtr(resultJson), resultJson);
  }

  public CkTask CallFunctionAsync(CkJsonObject funcJson, CkJsonObject resultJson) {
    long cPtr = chilkatJNI.CkJs_CallFunctionAsync(swigCPtr, this, CkJsonObject.getCPtr(funcJson), funcJson, CkJsonObject.getCPtr(resultJson), resultJson);
    return (cPtr == 0) ? null : new CkTask(cPtr, true);
  }

  public void ConsoleOutputSb(CkStringBuilder sb) {
    chilkatJNI.CkJs_ConsoleOutputSb(swigCPtr, this, CkStringBuilder.getCPtr(sb), sb);
  }

  public boolean Eval(CkStringBuilder jscript, CkJsonObject resultJson) {
    return chilkatJNI.CkJs_Eval(swigCPtr, this, CkStringBuilder.getCPtr(jscript), jscript, CkJsonObject.getCPtr(resultJson), resultJson);
  }

  public CkTask EvalAsync(CkStringBuilder jscript, CkJsonObject resultJson) {
    long cPtr = chilkatJNI.CkJs_EvalAsync(swigCPtr, this, CkStringBuilder.getCPtr(jscript), jscript, CkJsonObject.getCPtr(resultJson), resultJson);
    return (cPtr == 0) ? null : new CkTask(cPtr, true);
  }

  public boolean SetCkPermission(String chilkatClassName, String permission) {
    return chilkatJNI.CkJs_SetCkPermission(swigCPtr, this, chilkatClassName, permission);
  }

}
