#
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the 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 org.opensearch.painless.api.Debug {
  void explain(Object)
}

#### ES Scripting API

class org.opensearch.common.geo.GeoPoint {
  double getLat()
  double getLon()
}

class org.opensearch.index.fielddata.ScriptDocValues$Strings {
  String get(int)
  String getValue()
}

class org.opensearch.index.fielddata.ScriptDocValues$Longs {
  Long get(int)
  long getValue()
}

class org.opensearch.index.fielddata.ScriptDocValues$UnsignedLongs {
  BigInteger get(int)
  BigInteger getValue()
}

class org.opensearch.index.fielddata.ScriptDocValues$Dates {
  ZonedDateTime get(int)
  ZonedDateTime getValue()
}

class org.opensearch.index.fielddata.ScriptDocValues$Doubles {
  Double get(int)
  double getValue()
}

class org.opensearch.index.fielddata.ScriptDocValues$GeoPoints {
  org.opensearch.common.geo.GeoPoint get(int)
  org.opensearch.common.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 org.opensearch.index.fielddata.ScriptDocValues$Booleans {
  Boolean get(int)
  boolean getValue()
}

class org.opensearch.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 org.opensearch.search.lookup.FieldLookup {
  def getValue()
  List getValues()
  boolean isEmpty()
}

class org.opensearch.index.similarity.ScriptedSimilarity$Query {
  float getBoost()
}

class org.opensearch.index.similarity.ScriptedSimilarity$Field {
  long getDocCount()
  long getSumDocFreq()
  long getSumTotalTermFreq()
}

class org.opensearch.index.similarity.ScriptedSimilarity$Term {
  long getDocFreq()
  long getTotalTermFreq()
}

class org.opensearch.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()
}
