// 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::coreroot::*;
use crate::*;

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

impl ImmutableFindContractResults {
    // encoded contract record
    pub fn contract_found(&self) -> ScImmutableBytes {
		ScImmutableBytes::new(self.proxy.root(RESULT_CONTRACT_FOUND))
	}

    // encoded contract record
    pub fn contract_rec_data(&self) -> ScImmutableBytes {
		ScImmutableBytes::new(self.proxy.root(RESULT_CONTRACT_REC_DATA))
	}
}

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

impl MutableFindContractResults {
    // encoded contract record
    pub fn contract_found(&self) -> ScMutableBytes {
		ScMutableBytes::new(self.proxy.root(RESULT_CONTRACT_FOUND))
	}

    // encoded contract record
    pub fn contract_rec_data(&self) -> ScMutableBytes {
		ScMutableBytes::new(self.proxy.root(RESULT_CONTRACT_REC_DATA))
	}
}

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

impl MapHnameToImmutableBytes {
    pub fn get_bytes(&self, key: ScHname) -> ScImmutableBytes {
        ScImmutableBytes::new(self.proxy.key(&hname_to_bytes(key)))
    }
}

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

impl ImmutableGetContractRecordsResults {
    // contract records
    pub fn contract_registry(&self) -> MapHnameToImmutableBytes {
		MapHnameToImmutableBytes { proxy: self.proxy.root(RESULT_CONTRACT_REGISTRY) }
	}
}

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

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

    pub fn get_bytes(&self, key: ScHname) -> ScMutableBytes {
        ScMutableBytes::new(self.proxy.key(&hname_to_bytes(key)))
    }
}

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

impl MutableGetContractRecordsResults {
    // contract records
    pub fn contract_registry(&self) -> MapHnameToMutableBytes {
		MapHnameToMutableBytes { proxy: self.proxy.root(RESULT_CONTRACT_REGISTRY) }
	}
}
