# Copyright (c) 2023 Yuki Kimoto
# MIT License

class Native::Method : pointer {
  version_from SPVM;

  allow Native::BasicType;
  
  use Address;
  use Native::BasicType;
  use Native::Arg;
  use Fn;
  
  # Fields
  has runtime : Native::Runtime;
  
  # Class Method
  private static method new_with_pointer : Native::Method ($pointer : Address, $options : object[] = undef) {
    
    my $self = new Native::Method;
    
    Fn->set_pointer($self, $pointer);
    
    return $self;
  }
  
  # Instance Methods
  native method get_index : int ();
  
  native method get_name : string ();
  
  native method get_return_basic_type : Native::BasicType ();
  
  native method get_return_type_dimension : int ();
  
  native method get_return_type_flag : int ();
  
  native method get_current_basic_type : Native::BasicType ();
  
  native method get_arg_by_index : Native::Arg ($arg_index : int);
  
  native method get_args_length : int ();
  
  native method get_required_args_length : int ();
  
  native method is_class_method : int ();
  
  native method is_anon : int ();
  
  native method is_native : int ();
  
  native method is_precompile : int ();
  
  native method is_enum : int ();
  
  native method get_native_address : Address ();
  
  native method set_native_address : void ($address : Address);
  
  native method get_precompile_address : Address ();
  
  native method set_precompile_address : void ($address : Address);
  
  native method is_precompile_fallback : int ();
  
  native method set_is_precompile_fallback : void ($is_precompile_fallback : int);
  
  native method get_args_signature : string ();
  
}
