/**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/

import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
import { StdFee } from "@cosmjs/amino";
import { Uint128, InstantiateMsg, Coin, ExecuteMsg, MessageSignature, NymAddress, ServiceType, ServiceDetails, QueryMsg, MigrateMsg, Addr, PagedServicesListResponse, Service, ServicesListResponse, ConfigResponse, ContractVersion, ContractBuildInformation, Uint32 } from "./ServiceProviderDirectory.types";
import { GetCw2ContractVersionResponse } from './types';
export interface ServiceProviderDirectoryReadOnlyInterface {
  contractAddress: string;
  serviceId: ({
    serviceId
  }: {
    serviceId: number;
  }) => Promise<Service>;
  byAnnouncer: ({
    announcer
  }: {
    announcer: string;
  }) => Promise<ServicesListResponse>;
  byNymAddress: ({
    nymAddress
  }: {
    nymAddress: NymAddress;
  }) => Promise<ServicesListResponse>;
  all: ({
    limit,
    startAfter
  }: {
    limit?: number;
    startAfter?: number;
  }) => Promise<PagedServicesListResponse>;
  signingNonce: ({
    address
  }: {
    address: string;
  }) => Promise<Uint32>;
  config: () => Promise<ConfigResponse>;
  getContractVersion: () => Promise<ContractBuildInformation>;
  getCw2ContractVersion: () => Promise<GetCw2ContractVersionResponse>;
}
export class ServiceProviderDirectoryQueryClient implements ServiceProviderDirectoryReadOnlyInterface {
  client: CosmWasmClient;
  contractAddress: string;

  constructor(client: CosmWasmClient, contractAddress: string) {
    this.client = client;
    this.contractAddress = contractAddress;
    this.serviceId = this.serviceId.bind(this);
    this.byAnnouncer = this.byAnnouncer.bind(this);
    this.byNymAddress = this.byNymAddress.bind(this);
    this.all = this.all.bind(this);
    this.signingNonce = this.signingNonce.bind(this);
    this.config = this.config.bind(this);
    this.getContractVersion = this.getContractVersion.bind(this);
    this.getCw2ContractVersion = this.getCw2ContractVersion.bind(this);
  }

  serviceId = async ({
    serviceId
  }: {
    serviceId: number;
  }): Promise<Service> => {
    return this.client.queryContractSmart(this.contractAddress, {
      service_id: {
        service_id: serviceId
      }
    });
  };
  byAnnouncer = async ({
    announcer
  }: {
    announcer: string;
  }): Promise<ServicesListResponse> => {
    return this.client.queryContractSmart(this.contractAddress, {
      by_announcer: {
        announcer
      }
    });
  };
  byNymAddress = async ({
    nymAddress
  }: {
    nymAddress: NymAddress;
  }): Promise<ServicesListResponse> => {
    return this.client.queryContractSmart(this.contractAddress, {
      by_nym_address: {
        nym_address: nymAddress
      }
    });
  };
  all = async ({
    limit,
    startAfter
  }: {
    limit?: number;
    startAfter?: number;
  }): Promise<PagedServicesListResponse> => {
    return this.client.queryContractSmart(this.contractAddress, {
      all: {
        limit,
        start_after: startAfter
      }
    });
  };
  signingNonce = async ({
    address
  }: {
    address: string;
  }): Promise<Uint32> => {
    return this.client.queryContractSmart(this.contractAddress, {
      signing_nonce: {
        address
      }
    });
  };
  config = async (): Promise<ConfigResponse> => {
    return this.client.queryContractSmart(this.contractAddress, {
      config: {}
    });
  };
  getContractVersion = async (): Promise<ContractBuildInformation> => {
    return this.client.queryContractSmart(this.contractAddress, {
      get_contract_version: {}
    });
  };
  getCw2ContractVersion = async (): Promise<GetCw2ContractVersionResponse> => {
    return this.client.queryContractSmart(this.contractAddress, {
      get_cw2_contract_version: {}
    });
  };
}
export interface ServiceProviderDirectoryInterface extends ServiceProviderDirectoryReadOnlyInterface {
  contractAddress: string;
  sender: string;
  announce: ({
    ownerSignature,
    service
  }: {
    ownerSignature: MessageSignature;
    service: ServiceDetails;
  }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
  deleteId: ({
    serviceId
  }: {
    serviceId: number;
  }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
  deleteNymAddress: ({
    nymAddress
  }: {
    nymAddress: NymAddress;
  }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
  updateDepositRequired: ({
    depositRequired
  }: {
    depositRequired: Coin;
  }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
}
export class ServiceProviderDirectoryClient extends ServiceProviderDirectoryQueryClient implements ServiceProviderDirectoryInterface {
  client: SigningCosmWasmClient;
  sender: string;
  contractAddress: string;

  constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
    super(client, contractAddress);
    this.client = client;
    this.sender = sender;
    this.contractAddress = contractAddress;
    this.announce = this.announce.bind(this);
    this.deleteId = this.deleteId.bind(this);
    this.deleteNymAddress = this.deleteNymAddress.bind(this);
    this.updateDepositRequired = this.updateDepositRequired.bind(this);
  }

  announce = async ({
    ownerSignature,
    service
  }: {
    ownerSignature: MessageSignature;
    service: ServiceDetails;
  }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
    return await this.client.execute(this.sender, this.contractAddress, {
      announce: {
        owner_signature: ownerSignature,
        service
      }
    }, fee, memo, _funds);
  };
  deleteId = async ({
    serviceId
  }: {
    serviceId: number;
  }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
    return await this.client.execute(this.sender, this.contractAddress, {
      delete_id: {
        service_id: serviceId
      }
    }, fee, memo, _funds);
  };
  deleteNymAddress = async ({
    nymAddress
  }: {
    nymAddress: NymAddress;
  }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
    return await this.client.execute(this.sender, this.contractAddress, {
      delete_nym_address: {
        nym_address: nymAddress
      }
    }, fee, memo, _funds);
  };
  updateDepositRequired = async ({
    depositRequired
  }: {
    depositRequired: Coin;
  }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
    return await this.client.execute(this.sender, this.contractAddress, {
      update_deposit_required: {
        deposit_required: depositRequired
      }
    }, fee, memo, _funds);
  };
}
