// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.3.0
//   protoc               unknown
// source: feeabstraction/feeabs/v1beta1/proposal.proto

/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";

/** HostChainFeeAbsStatus */
export enum HostChainFeeAbsStatus {
  UPDATED = 0,
  OUTDATED = 1,
  FROZEN = 2,
  UNRECOGNIZED = -1,
}

export function hostChainFeeAbsStatusFromJSON(object: any): HostChainFeeAbsStatus {
  switch (object) {
    case 0:
    case "UPDATED":
      return HostChainFeeAbsStatus.UPDATED;
    case 1:
    case "OUTDATED":
      return HostChainFeeAbsStatus.OUTDATED;
    case 2:
    case "FROZEN":
      return HostChainFeeAbsStatus.FROZEN;
    case -1:
    case "UNRECOGNIZED":
    default:
      return HostChainFeeAbsStatus.UNRECOGNIZED;
  }
}

export function hostChainFeeAbsStatusToJSON(object: HostChainFeeAbsStatus): string {
  switch (object) {
    case HostChainFeeAbsStatus.UPDATED:
      return "UPDATED";
    case HostChainFeeAbsStatus.OUTDATED:
      return "OUTDATED";
    case HostChainFeeAbsStatus.FROZEN:
      return "FROZEN";
    case HostChainFeeAbsStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

/** HostChainFeeAbsConfig */
export interface HostChainFeeAbsConfig {
  /** ibc token is allowed to be used as fee token */
  ibcDenom: string;
  /** token_in in cross_chain swap contract. */
  osmosisPoolTokenDenomIn: string;
  /** pool id */
  poolId: bigint;
  /** Host chain fee abstraction connection status */
  status: HostChainFeeAbsStatus;
}

/** AddHostZoneProposal */
export interface AddHostZoneProposal {
  /** the title of the proposal */
  title: string;
  /** the description of the proposal */
  description: string;
  /** the host chain config */
  hostChainConfig: HostChainFeeAbsConfig | undefined;
}

/** DeleteHostZoneProposal */
export interface DeleteHostZoneProposal {
  /** the title of the proposal */
  title: string;
  /** the description of the proposal */
  description: string;
  /** the  ibc denom of this token */
  ibcDenom: string;
}

/** SetHostZoneProposal */
export interface SetHostZoneProposal {
  /** the title of the proposal */
  title: string;
  /** the description of the proposal */
  description: string;
  /** the host chain config */
  hostChainConfig: HostChainFeeAbsConfig | undefined;
}

function createBaseHostChainFeeAbsConfig(): HostChainFeeAbsConfig {
  return { ibcDenom: "", osmosisPoolTokenDenomIn: "", poolId: 0n, status: 0 };
}

export const HostChainFeeAbsConfig: MessageFns<HostChainFeeAbsConfig> = {
  encode(message: HostChainFeeAbsConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.ibcDenom !== "") {
      writer.uint32(10).string(message.ibcDenom);
    }
    if (message.osmosisPoolTokenDenomIn !== "") {
      writer.uint32(18).string(message.osmosisPoolTokenDenomIn);
    }
    if (message.poolId !== 0n) {
      if (BigInt.asUintN(64, message.poolId) !== message.poolId) {
        throw new globalThis.Error("value provided for field message.poolId of type uint64 too large");
      }
      writer.uint32(24).uint64(message.poolId);
    }
    if (message.status !== 0) {
      writer.uint32(32).int32(message.status);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): HostChainFeeAbsConfig {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseHostChainFeeAbsConfig();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.ibcDenom = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.osmosisPoolTokenDenomIn = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.poolId = reader.uint64() as bigint;
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.status = reader.int32() as any;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): HostChainFeeAbsConfig {
    return {
      ibcDenom: isSet(object.ibcDenom) ? globalThis.String(object.ibcDenom) : "",
      osmosisPoolTokenDenomIn: isSet(object.osmosisPoolTokenDenomIn)
        ? globalThis.String(object.osmosisPoolTokenDenomIn)
        : "",
      poolId: isSet(object.poolId) ? BigInt(object.poolId) : 0n,
      status: isSet(object.status) ? hostChainFeeAbsStatusFromJSON(object.status) : 0,
    };
  },

  toJSON(message: HostChainFeeAbsConfig): unknown {
    const obj: any = {};
    if (message.ibcDenom !== "") {
      obj.ibcDenom = message.ibcDenom;
    }
    if (message.osmosisPoolTokenDenomIn !== "") {
      obj.osmosisPoolTokenDenomIn = message.osmosisPoolTokenDenomIn;
    }
    if (message.poolId !== 0n) {
      obj.poolId = message.poolId.toString();
    }
    if (message.status !== 0) {
      obj.status = hostChainFeeAbsStatusToJSON(message.status);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<HostChainFeeAbsConfig>, I>>(base?: I): HostChainFeeAbsConfig {
    return HostChainFeeAbsConfig.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<HostChainFeeAbsConfig>, I>>(object: I): HostChainFeeAbsConfig {
    const message = createBaseHostChainFeeAbsConfig();
    message.ibcDenom = object.ibcDenom ?? "";
    message.osmosisPoolTokenDenomIn = object.osmosisPoolTokenDenomIn ?? "";
    message.poolId = object.poolId ?? 0n;
    message.status = object.status ?? 0;
    return message;
  },
};

function createBaseAddHostZoneProposal(): AddHostZoneProposal {
  return { title: "", description: "", hostChainConfig: undefined };
}

export const AddHostZoneProposal: MessageFns<AddHostZoneProposal> = {
  encode(message: AddHostZoneProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.title !== "") {
      writer.uint32(10).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(18).string(message.description);
    }
    if (message.hostChainConfig !== undefined) {
      HostChainFeeAbsConfig.encode(message.hostChainConfig, writer.uint32(26).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): AddHostZoneProposal {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseAddHostZoneProposal();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.hostChainConfig = HostChainFeeAbsConfig.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): AddHostZoneProposal {
    return {
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      hostChainConfig: isSet(object.hostChainConfig)
        ? HostChainFeeAbsConfig.fromJSON(object.hostChainConfig)
        : undefined,
    };
  },

  toJSON(message: AddHostZoneProposal): unknown {
    const obj: any = {};
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.hostChainConfig !== undefined) {
      obj.hostChainConfig = HostChainFeeAbsConfig.toJSON(message.hostChainConfig);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<AddHostZoneProposal>, I>>(base?: I): AddHostZoneProposal {
    return AddHostZoneProposal.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<AddHostZoneProposal>, I>>(object: I): AddHostZoneProposal {
    const message = createBaseAddHostZoneProposal();
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.hostChainConfig = (object.hostChainConfig !== undefined && object.hostChainConfig !== null)
      ? HostChainFeeAbsConfig.fromPartial(object.hostChainConfig)
      : undefined;
    return message;
  },
};

function createBaseDeleteHostZoneProposal(): DeleteHostZoneProposal {
  return { title: "", description: "", ibcDenom: "" };
}

export const DeleteHostZoneProposal: MessageFns<DeleteHostZoneProposal> = {
  encode(message: DeleteHostZoneProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.title !== "") {
      writer.uint32(10).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(18).string(message.description);
    }
    if (message.ibcDenom !== "") {
      writer.uint32(26).string(message.ibcDenom);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): DeleteHostZoneProposal {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseDeleteHostZoneProposal();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.ibcDenom = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): DeleteHostZoneProposal {
    return {
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      ibcDenom: isSet(object.ibcDenom) ? globalThis.String(object.ibcDenom) : "",
    };
  },

  toJSON(message: DeleteHostZoneProposal): unknown {
    const obj: any = {};
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.ibcDenom !== "") {
      obj.ibcDenom = message.ibcDenom;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<DeleteHostZoneProposal>, I>>(base?: I): DeleteHostZoneProposal {
    return DeleteHostZoneProposal.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<DeleteHostZoneProposal>, I>>(object: I): DeleteHostZoneProposal {
    const message = createBaseDeleteHostZoneProposal();
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.ibcDenom = object.ibcDenom ?? "";
    return message;
  },
};

function createBaseSetHostZoneProposal(): SetHostZoneProposal {
  return { title: "", description: "", hostChainConfig: undefined };
}

export const SetHostZoneProposal: MessageFns<SetHostZoneProposal> = {
  encode(message: SetHostZoneProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.title !== "") {
      writer.uint32(10).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(18).string(message.description);
    }
    if (message.hostChainConfig !== undefined) {
      HostChainFeeAbsConfig.encode(message.hostChainConfig, writer.uint32(26).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): SetHostZoneProposal {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetHostZoneProposal();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.hostChainConfig = HostChainFeeAbsConfig.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): SetHostZoneProposal {
    return {
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      hostChainConfig: isSet(object.hostChainConfig)
        ? HostChainFeeAbsConfig.fromJSON(object.hostChainConfig)
        : undefined,
    };
  },

  toJSON(message: SetHostZoneProposal): unknown {
    const obj: any = {};
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.hostChainConfig !== undefined) {
      obj.hostChainConfig = HostChainFeeAbsConfig.toJSON(message.hostChainConfig);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<SetHostZoneProposal>, I>>(base?: I): SetHostZoneProposal {
    return SetHostZoneProposal.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<SetHostZoneProposal>, I>>(object: I): SetHostZoneProposal {
    const message = createBaseSetHostZoneProposal();
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.hostChainConfig = (object.hostChainConfig !== undefined && object.hostChainConfig !== null)
      ? HostChainFeeAbsConfig.fromPartial(object.hostChainConfig)
      : undefined;
    return message;
  },
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;

type DeepPartial<T> = T extends Builtin ? T
  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P
  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };

function isSet(value: any): boolean {
  return value !== null && value !== undefined;
}

interface MessageFns<T> {
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
  decode(input: BinaryReader | Uint8Array, length?: number): T;
  fromJSON(object: any): T;
  toJSON(message: T): unknown;
  create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
  fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
