//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using Ajuna.NetApi;
using Ajuna.NetApi.Model.Extrinsics;
using Ajuna.NetApi.Model.Meta;
using Ajuna.NetApi.Model.Types;
using Ajuna.NetApi.Model.Types.Base;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;


namespace Bajun.Network.NET.NetApiExt.Generated.Storage
{
    
    
    public sealed class CouncilStorage
    {
        
        // Substrate client for the storage calls.
        private SubstrateClientExt _client;
        
        public CouncilStorage(SubstrateClientExt client)
        {
            this._client = client;
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "Proposals"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(null, null, typeof(Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT28)));
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "ProposalOf"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(new Ajuna.NetApi.Model.Meta.Storage.Hasher[] {
                            Ajuna.NetApi.Model.Meta.Storage.Hasher.Identity}, typeof(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256), typeof(Bajun.Network.NET.NetApiExt.Generated.Model.bajun_runtime.EnumRuntimeCall)));
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "Voting"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(new Ajuna.NetApi.Model.Meta.Storage.Hasher[] {
                            Ajuna.NetApi.Model.Meta.Storage.Hasher.Identity}, typeof(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256), typeof(Bajun.Network.NET.NetApiExt.Generated.Model.pallet_collective.Votes)));
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "ProposalCount"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(null, null, typeof(Ajuna.NetApi.Model.Types.Primitive.U32)));
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "Members"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(null, null, typeof(Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>)));
            _client.StorageKeyDict.Add(new System.Tuple<string, string>("Council", "Prime"), new System.Tuple<Ajuna.NetApi.Model.Meta.Storage.Hasher[], System.Type, System.Type>(null, null, typeof(Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32)));
        }
        
        /// <summary>
        /// >> ProposalsParams
        ///  The hashes of the active proposals.
        /// </summary>
        public static string ProposalsParams()
        {
            return RequestGenerator.GetStorage("Council", "Proposals", Ajuna.NetApi.Model.Meta.Storage.Type.Plain);
        }
        
        /// <summary>
        /// >> ProposalsDefault
        /// Default value as hex string
        /// </summary>
        public static string ProposalsDefault()
        {
            return "0x00";
        }
        
        /// <summary>
        /// >> Proposals
        ///  The hashes of the active proposals.
        /// </summary>
        public async Task<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT28> Proposals(CancellationToken token)
        {
            string parameters = CouncilStorage.ProposalsParams();
            var result = await _client.GetStorageAsync<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.bounded.bounded_vec.BoundedVecT28>(parameters, token);
            return result;
        }
        
        /// <summary>
        /// >> ProposalOfParams
        ///  Actual proposal for a given hash, if it's current.
        /// </summary>
        public static string ProposalOfParams(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key)
        {
            return RequestGenerator.GetStorage("Council", "ProposalOf", Ajuna.NetApi.Model.Meta.Storage.Type.Map, new Ajuna.NetApi.Model.Meta.Storage.Hasher[] {
                        Ajuna.NetApi.Model.Meta.Storage.Hasher.Identity}, new Ajuna.NetApi.Model.Types.IType[] {
                        key});
        }
        
        /// <summary>
        /// >> ProposalOfDefault
        /// Default value as hex string
        /// </summary>
        public static string ProposalOfDefault()
        {
            return "0x00";
        }
        
        /// <summary>
        /// >> ProposalOf
        ///  Actual proposal for a given hash, if it's current.
        /// </summary>
        public async Task<Bajun.Network.NET.NetApiExt.Generated.Model.bajun_runtime.EnumRuntimeCall> ProposalOf(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key, CancellationToken token)
        {
            string parameters = CouncilStorage.ProposalOfParams(key);
            var result = await _client.GetStorageAsync<Bajun.Network.NET.NetApiExt.Generated.Model.bajun_runtime.EnumRuntimeCall>(parameters, token);
            return result;
        }
        
        /// <summary>
        /// >> VotingParams
        ///  Votes on a given proposal, if it is ongoing.
        /// </summary>
        public static string VotingParams(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key)
        {
            return RequestGenerator.GetStorage("Council", "Voting", Ajuna.NetApi.Model.Meta.Storage.Type.Map, new Ajuna.NetApi.Model.Meta.Storage.Hasher[] {
                        Ajuna.NetApi.Model.Meta.Storage.Hasher.Identity}, new Ajuna.NetApi.Model.Types.IType[] {
                        key});
        }
        
        /// <summary>
        /// >> VotingDefault
        /// Default value as hex string
        /// </summary>
        public static string VotingDefault()
        {
            return "0x00";
        }
        
        /// <summary>
        /// >> Voting
        ///  Votes on a given proposal, if it is ongoing.
        /// </summary>
        public async Task<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_collective.Votes> Voting(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 key, CancellationToken token)
        {
            string parameters = CouncilStorage.VotingParams(key);
            var result = await _client.GetStorageAsync<Bajun.Network.NET.NetApiExt.Generated.Model.pallet_collective.Votes>(parameters, token);
            return result;
        }
        
        /// <summary>
        /// >> ProposalCountParams
        ///  Proposals so far.
        /// </summary>
        public static string ProposalCountParams()
        {
            return RequestGenerator.GetStorage("Council", "ProposalCount", Ajuna.NetApi.Model.Meta.Storage.Type.Plain);
        }
        
        /// <summary>
        /// >> ProposalCountDefault
        /// Default value as hex string
        /// </summary>
        public static string ProposalCountDefault()
        {
            return "0x00000000";
        }
        
        /// <summary>
        /// >> ProposalCount
        ///  Proposals so far.
        /// </summary>
        public async Task<Ajuna.NetApi.Model.Types.Primitive.U32> ProposalCount(CancellationToken token)
        {
            string parameters = CouncilStorage.ProposalCountParams();
            var result = await _client.GetStorageAsync<Ajuna.NetApi.Model.Types.Primitive.U32>(parameters, token);
            return result;
        }
        
        /// <summary>
        /// >> MembersParams
        ///  The current members of the collective. This is stored sorted (just by value).
        /// </summary>
        public static string MembersParams()
        {
            return RequestGenerator.GetStorage("Council", "Members", Ajuna.NetApi.Model.Meta.Storage.Type.Plain);
        }
        
        /// <summary>
        /// >> MembersDefault
        /// Default value as hex string
        /// </summary>
        public static string MembersDefault()
        {
            return "0x00";
        }
        
        /// <summary>
        /// >> Members
        ///  The current members of the collective. This is stored sorted (just by value).
        /// </summary>
        public async Task<Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>> Members(CancellationToken token)
        {
            string parameters = CouncilStorage.MembersParams();
            var result = await _client.GetStorageAsync<Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>>(parameters, token);
            return result;
        }
        
        /// <summary>
        /// >> PrimeParams
        ///  The prime member that helps determine the default vote behavior in case of absentations.
        /// </summary>
        public static string PrimeParams()
        {
            return RequestGenerator.GetStorage("Council", "Prime", Ajuna.NetApi.Model.Meta.Storage.Type.Plain);
        }
        
        /// <summary>
        /// >> PrimeDefault
        /// Default value as hex string
        /// </summary>
        public static string PrimeDefault()
        {
            return "0x00";
        }
        
        /// <summary>
        /// >> Prime
        ///  The prime member that helps determine the default vote behavior in case of absentations.
        /// </summary>
        public async Task<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> Prime(CancellationToken token)
        {
            string parameters = CouncilStorage.PrimeParams();
            var result = await _client.GetStorageAsync<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32>(parameters, token);
            return result;
        }
    }
    
    public sealed class CouncilCalls
    {
        
        /// <summary>
        /// >> set_members
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method SetMembers(Ajuna.NetApi.Model.Types.Base.BaseVec<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> new_members, Ajuna.NetApi.Model.Types.Base.BaseOpt<Bajun.Network.NET.NetApiExt.Generated.Model.sp_core.crypto.AccountId32> prime, Ajuna.NetApi.Model.Types.Primitive.U32 old_count)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(new_members.Encode());
            byteArray.AddRange(prime.Encode());
            byteArray.AddRange(old_count.Encode());
            return new Method(42, "Council", 0, "set_members", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> execute
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method Execute(Bajun.Network.NET.NetApiExt.Generated.Model.bajun_runtime.EnumRuntimeCall proposal, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> length_bound)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(proposal.Encode());
            byteArray.AddRange(length_bound.Encode());
            return new Method(42, "Council", 1, "execute", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> propose
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method Propose(Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> threshold, Bajun.Network.NET.NetApiExt.Generated.Model.bajun_runtime.EnumRuntimeCall proposal, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> length_bound)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(threshold.Encode());
            byteArray.AddRange(proposal.Encode());
            byteArray.AddRange(length_bound.Encode());
            return new Method(42, "Council", 2, "propose", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> vote
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method Vote(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 proposal, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> index, Ajuna.NetApi.Model.Types.Primitive.Bool approve)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(proposal.Encode());
            byteArray.AddRange(index.Encode());
            byteArray.AddRange(approve.Encode());
            return new Method(42, "Council", 3, "vote", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> close_old_weight
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method CloseOldWeight(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 proposal_hash, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> index, Ajuna.NetApi.Model.Types.Base.BaseCom<Bajun.Network.NET.NetApiExt.Generated.Model.sp_weights.OldWeight> proposal_weight_bound, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> length_bound)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(proposal_hash.Encode());
            byteArray.AddRange(index.Encode());
            byteArray.AddRange(proposal_weight_bound.Encode());
            byteArray.AddRange(length_bound.Encode());
            return new Method(42, "Council", 4, "close_old_weight", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> disapprove_proposal
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method DisapproveProposal(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 proposal_hash)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(proposal_hash.Encode());
            return new Method(42, "Council", 5, "disapprove_proposal", byteArray.ToArray());
        }
        
        /// <summary>
        /// >> close
        /// Contains one variant per dispatchable that can be called by an extrinsic.
        /// </summary>
        public static Method Close(Bajun.Network.NET.NetApiExt.Generated.Model.primitive_types.H256 proposal_hash, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> index, Bajun.Network.NET.NetApiExt.Generated.Model.sp_weights.weight_v2.Weight proposal_weight_bound, Ajuna.NetApi.Model.Types.Base.BaseCom<Ajuna.NetApi.Model.Types.Primitive.U32> length_bound)
        {
            System.Collections.Generic.List<byte> byteArray = new List<byte>();
            byteArray.AddRange(proposal_hash.Encode());
            byteArray.AddRange(index.Encode());
            byteArray.AddRange(proposal_weight_bound.Encode());
            byteArray.AddRange(length_bound.Encode());
            return new Method(42, "Council", 6, "close", byteArray.ToArray());
        }
    }
    
    public sealed class CouncilConstants
    {
    }
    
    public enum CouncilErrors
    {
        
        /// <summary>
        /// >> NotMember
        /// Account is not a member
        /// </summary>
        NotMember,
        
        /// <summary>
        /// >> DuplicateProposal
        /// Duplicate proposals not allowed
        /// </summary>
        DuplicateProposal,
        
        /// <summary>
        /// >> ProposalMissing
        /// Proposal must exist
        /// </summary>
        ProposalMissing,
        
        /// <summary>
        /// >> WrongIndex
        /// Mismatched index
        /// </summary>
        WrongIndex,
        
        /// <summary>
        /// >> DuplicateVote
        /// Duplicate vote ignored
        /// </summary>
        DuplicateVote,
        
        /// <summary>
        /// >> AlreadyInitialized
        /// Members are already initialized!
        /// </summary>
        AlreadyInitialized,
        
        /// <summary>
        /// >> TooEarly
        /// The close call was made too early, before the end of the voting.
        /// </summary>
        TooEarly,
        
        /// <summary>
        /// >> TooManyProposals
        /// There can only be a maximum of `MaxProposals` active proposals.
        /// </summary>
        TooManyProposals,
        
        /// <summary>
        /// >> WrongProposalWeight
        /// The given weight bound for the proposal was too low.
        /// </summary>
        WrongProposalWeight,
        
        /// <summary>
        /// >> WrongProposalLength
        /// The given length bound for the proposal was too low.
        /// </summary>
        WrongProposalLength,
    }
}
