// Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

// (Re-)generated by schema tool
// >>>> DO NOT CHANGE THIS FILE! <<<<
// Change the json schema instead

#![allow(dead_code)]
#![allow(unused_imports)]

use crate::coregovernance::*;
use crate::*;

#[derive(Clone)]
pub struct ArrayOfImmutableAddress {
	pub(crate) proxy: Proxy,
}

impl ArrayOfImmutableAddress {
    pub fn length(&self) -> u32 {
        self.proxy.length()
    }

    pub fn get_address(&self, index: u32) -> ScImmutableAddress {
        ScImmutableAddress::new(self.proxy.index(index))
    }
}

#[derive(Clone)]
pub struct ImmutableGetAllowedStateControllerAddressesResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetAllowedStateControllerAddressesResults {
    // native contract, so this is an Array16
    pub fn allowed_state_controller_addresses(&self) -> ArrayOfImmutableAddress {
		ArrayOfImmutableAddress { proxy: self.proxy.root(RESULT_ALLOWED_STATE_CONTROLLER_ADDRESSES) }
	}
}

#[derive(Clone)]
pub struct ArrayOfMutableAddress {
	pub(crate) proxy: Proxy,
}

impl ArrayOfMutableAddress {
	pub fn append_address(&self) -> ScMutableAddress {
		ScMutableAddress::new(self.proxy.append())
	}

	pub fn clear(&self) {
        self.proxy.clear_array();
    }

    pub fn length(&self) -> u32 {
        self.proxy.length()
    }

    pub fn get_address(&self, index: u32) -> ScMutableAddress {
        ScMutableAddress::new(self.proxy.index(index))
    }
}

#[derive(Clone)]
pub struct MutableGetAllowedStateControllerAddressesResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetAllowedStateControllerAddressesResults {
    // native contract, so this is an Array16
    pub fn allowed_state_controller_addresses(&self) -> ArrayOfMutableAddress {
		ArrayOfMutableAddress { proxy: self.proxy.root(RESULT_ALLOWED_STATE_CONTROLLER_ADDRESSES) }
	}
}

#[derive(Clone)]
pub struct ImmutableGetChainInfoResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetChainInfoResults {
    pub fn chain_id(&self) -> ScImmutableChainID {
		ScImmutableChainID::new(self.proxy.root(RESULT_CHAIN_ID))
	}

    pub fn chain_owner_id(&self) -> ScImmutableAgentID {
		ScImmutableAgentID::new(self.proxy.root(RESULT_CHAIN_OWNER_ID))
	}

    pub fn description(&self) -> ScImmutableString {
		ScImmutableString::new(self.proxy.root(RESULT_DESCRIPTION))
	}

    pub fn gas_fee_policy_bytes(&self) -> ScImmutableBytes {
		ScImmutableBytes::new(self.proxy.root(RESULT_GAS_FEE_POLICY_BYTES))
	}

    pub fn max_blob_size(&self) -> ScImmutableUint32 {
		ScImmutableUint32::new(self.proxy.root(RESULT_MAX_BLOB_SIZE))
	}

    pub fn max_event_size(&self) -> ScImmutableUint16 {
		ScImmutableUint16::new(self.proxy.root(RESULT_MAX_EVENT_SIZE))
	}

    pub fn max_events_per_req(&self) -> ScImmutableUint16 {
		ScImmutableUint16::new(self.proxy.root(RESULT_MAX_EVENTS_PER_REQ))
	}
}

#[derive(Clone)]
pub struct MutableGetChainInfoResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetChainInfoResults {
    pub fn chain_id(&self) -> ScMutableChainID {
		ScMutableChainID::new(self.proxy.root(RESULT_CHAIN_ID))
	}

    pub fn chain_owner_id(&self) -> ScMutableAgentID {
		ScMutableAgentID::new(self.proxy.root(RESULT_CHAIN_OWNER_ID))
	}

    pub fn description(&self) -> ScMutableString {
		ScMutableString::new(self.proxy.root(RESULT_DESCRIPTION))
	}

    pub fn gas_fee_policy_bytes(&self) -> ScMutableBytes {
		ScMutableBytes::new(self.proxy.root(RESULT_GAS_FEE_POLICY_BYTES))
	}

    pub fn max_blob_size(&self) -> ScMutableUint32 {
		ScMutableUint32::new(self.proxy.root(RESULT_MAX_BLOB_SIZE))
	}

    pub fn max_event_size(&self) -> ScMutableUint16 {
		ScMutableUint16::new(self.proxy.root(RESULT_MAX_EVENT_SIZE))
	}

    pub fn max_events_per_req(&self) -> ScMutableUint16 {
		ScMutableUint16::new(self.proxy.root(RESULT_MAX_EVENTS_PER_REQ))
	}
}

#[derive(Clone)]
pub struct MapBytesToImmutableBytes {
	pub(crate) proxy: Proxy,
}

impl MapBytesToImmutableBytes {
    pub fn get_bytes(&self, key: &[u8]) -> ScImmutableBytes {
        ScImmutableBytes::new(self.proxy.key(&bytes_to_bytes(key)))
    }
}

#[derive(Clone)]
pub struct ImmutableGetChainNodesResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetChainNodesResults {
    pub fn access_node_candidates(&self) -> MapBytesToImmutableBytes {
		MapBytesToImmutableBytes { proxy: self.proxy.root(RESULT_ACCESS_NODE_CANDIDATES) }
	}

    pub fn access_nodes(&self) -> MapBytesToImmutableBytes {
		MapBytesToImmutableBytes { proxy: self.proxy.root(RESULT_ACCESS_NODES) }
	}
}

#[derive(Clone)]
pub struct MapBytesToMutableBytes {
	pub(crate) proxy: Proxy,
}

impl MapBytesToMutableBytes {
    pub fn clear(&self) {
        self.proxy.clear_map();
    }

    pub fn get_bytes(&self, key: &[u8]) -> ScMutableBytes {
        ScMutableBytes::new(self.proxy.key(&bytes_to_bytes(key)))
    }
}

#[derive(Clone)]
pub struct MutableGetChainNodesResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetChainNodesResults {
    pub fn access_node_candidates(&self) -> MapBytesToMutableBytes {
		MapBytesToMutableBytes { proxy: self.proxy.root(RESULT_ACCESS_NODE_CANDIDATES) }
	}

    pub fn access_nodes(&self) -> MapBytesToMutableBytes {
		MapBytesToMutableBytes { proxy: self.proxy.root(RESULT_ACCESS_NODES) }
	}
}

#[derive(Clone)]
pub struct ImmutableGetChainOwnerResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetChainOwnerResults {
    pub fn chain_owner(&self) -> ScImmutableAgentID {
		ScImmutableAgentID::new(self.proxy.root(RESULT_CHAIN_OWNER))
	}
}

#[derive(Clone)]
pub struct MutableGetChainOwnerResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetChainOwnerResults {
    pub fn chain_owner(&self) -> ScMutableAgentID {
		ScMutableAgentID::new(self.proxy.root(RESULT_CHAIN_OWNER))
	}
}

#[derive(Clone)]
pub struct ImmutableGetFeePolicyResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetFeePolicyResults {
    pub fn fee_policy_bytes(&self) -> ScImmutableBytes {
		ScImmutableBytes::new(self.proxy.root(RESULT_FEE_POLICY_BYTES))
	}
}

#[derive(Clone)]
pub struct MutableGetFeePolicyResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetFeePolicyResults {
    pub fn fee_policy_bytes(&self) -> ScMutableBytes {
		ScMutableBytes::new(self.proxy.root(RESULT_FEE_POLICY_BYTES))
	}
}

#[derive(Clone)]
pub struct ImmutableGetMaxBlobSizeResults {
	pub(crate) proxy: Proxy,
}

impl ImmutableGetMaxBlobSizeResults {
    pub fn max_blob_size(&self) -> ScImmutableUint32 {
		ScImmutableUint32::new(self.proxy.root(RESULT_MAX_BLOB_SIZE))
	}
}

#[derive(Clone)]
pub struct MutableGetMaxBlobSizeResults {
	pub(crate) proxy: Proxy,
}

impl MutableGetMaxBlobSizeResults {
    pub fn max_blob_size(&self) -> ScMutableUint32 {
		ScMutableUint32::new(self.proxy.root(RESULT_MAX_BLOB_SIZE))
	}
}
