# SPDX-License-Identifier: SSPL-1.0
#
# The Lucenia project is source-available software: you can
# redistribute it and/or modify it under the terms of the
# Server Side Public License, version 1, as published by
# MongoDB, Inc.
#
# As per the terms of the Server Side Public License, if you
# make the functionality of this program or a modified version
# available over a network, you must make the source code
# available for download.
#
# The full text of the Server Side Public License, version 1,
# can be found at:
# https://www.mongodb.com/licensing/server-side-public-license

#
# Painless definition file. This defines the hierarchy of classes,
# what methods and fields they have, etc.
#

#### Primitive types

class void @no_import {
}

class boolean @no_import {
}

class byte @no_import {
}

class short @no_import {
}

class char @no_import {
}

class int @no_import {
}

class long @no_import {
}

class float @no_import {
}

class double @no_import {
}

#### Painless debugging API

class io.lucenia.painless.api.Debug {
  void explain(Object)
}

#### ES Scripting API

class io.skylite.core.geo.GeoPoint {
  double getLat()
  double getLon()
}

class io.skylite.core.index.fielddata.ScriptDocValues$Strings {
  String get(int)
  String getValue()
}

class io.skylite.core.index.fielddata.ScriptDocValues$Longs {
  Long get(int)
  long getValue()
}

class io.skylite.core.index.fielddata.ScriptDocValues$UnsignedLongs {
  BigInteger get(int)
  BigInteger getValue()
}

class io.skylite.core.index.fielddata.ScriptDocValues$Dates {
  ZonedDateTime get(int)
  ZonedDateTime getValue()
}

class io.skylite.core.index.fielddata.ScriptDocValues$Doubles {
  Double get(int)
  double getValue()
}

class io.skylite.core.index.fielddata.geo.AbstractLeafGeoPointFieldData$GeoPoints {
  io.skylite.core.geo.GeoPoint get(int)
  io.skylite.core.geo.GeoPoint getValue()
  double getLat()
  double getLon()
  double[] getLats()
  double[] getLons()

  # geo distance functions
  double arcDistance(double,double)
  double arcDistanceWithDefault(double,double,double)
  double planeDistance(double,double)
  double planeDistanceWithDefault(double,double,double)
  double geohashDistance(String)
  double geohashDistanceWithDefault(String,double)
}

class io.skylite.core.index.fielddata.ScriptDocValues$Booleans {
  Boolean get(int)
  boolean getValue()
}

class io.skylite.core.index.fielddata.ScriptDocValues$BytesRefs {
  BytesRef get(int)
  BytesRef getValue()
}

class org.apache.lucene.util.BytesRef {
  byte[] bytes
  int offset
  int length
  boolean bytesEquals(BytesRef)
  String utf8ToString()
}

class org.opensearch.index.mapper.IpFieldMapper$IpFieldType$IpScriptDocValues {
  String get(int)
  String getValue()
}

class io.skylite.core.search.lookup.FieldLookup {
  def getValue()
  List getValues()
  boolean isEmpty()
}

class io.skylite.core.index.similarity.ScriptedSimilarity$Query {
  float getBoost()
}

class io.skylite.core.index.similarity.ScriptedSimilarity$Field {
  long getDocCount()
  long getSumDocFreq()
  long getSumTotalTermFreq()
}

class io.skylite.core.index.similarity.ScriptedSimilarity$Term {
  long getDocFreq()
  long getTotalTermFreq()
}

class io.skylite.core.index.similarity.ScriptedSimilarity$Doc {
  int getLength()
  float getFreq()
}

class org.opensearch.index.query.IntervalFilterScript$Interval {
  int getStart()
  int getEnd()
  int getGaps()
}

class org.opensearch.script.ScoreScript$ExplanationHolder {
  void set(String)
}

class org.opensearch.search.aggregations.metrics.ScriptedAvg {
  (double,long)
  double getSum()
  long getCount()
  double getValue()
}
