import { ServiceType } from "@protobuf-ts/runtime-rpc";
import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { FieldMask } from "../../../../../../google/protobuf/field_mask.js";
class IdentityProviderConfig$Type extends MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.IdentityProviderConfig", [
      {
        no: 1,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "is_deactivated",
        kind: "scalar",
        T: 8
      },
      {
        no: 3,
        name: "issuer",
        kind: "scalar",
        T: 9
      },
      {
        no: 4,
        name: "jwks_url",
        kind: "scalar",
        T: 9
      },
      {
        no: 5,
        name: "audience",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.identityProviderId = "";
    message.isDeactivated = false;
    message.issuer = "";
    message.jwksUrl = "";
    message.audience = "";
    if (value !== void 0)
      reflectionMergePartial(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string identity_provider_id */
        1:
          message.identityProviderId = reader.string();
          break;
        case /* bool is_deactivated */
        2:
          message.isDeactivated = reader.bool();
          break;
        case /* string issuer */
        3:
          message.issuer = reader.string();
          break;
        case /* string jwks_url */
        4:
          message.jwksUrl = reader.string();
          break;
        case /* string audience */
        5:
          message.audience = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderId !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.identityProviderId);
    if (message.isDeactivated !== false)
      writer.tag(2, WireType.Varint).bool(message.isDeactivated);
    if (message.issuer !== "")
      writer.tag(3, WireType.LengthDelimited).string(message.issuer);
    if (message.jwksUrl !== "")
      writer.tag(4, WireType.LengthDelimited).string(message.jwksUrl);
    if (message.audience !== "")
      writer.tag(5, WireType.LengthDelimited).string(message.audience);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const IdentityProviderConfig = new IdentityProviderConfig$Type();
class CreateIdentityProviderConfigRequest$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.CreateIdentityProviderConfigRequest",
      [
        {
          no: 1,
          name: "identity_provider_config",
          kind: "message",
          T: () => IdentityProviderConfig
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_config */
        1:
          message.identityProviderConfig = IdentityProviderConfig.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.identityProviderConfig
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderConfig)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfig,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const CreateIdentityProviderConfigRequest = new CreateIdentityProviderConfigRequest$Type();
class CreateIdentityProviderConfigResponse$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.CreateIdentityProviderConfigResponse",
      [
        {
          no: 1,
          name: "identity_provider_config",
          kind: "message",
          T: () => IdentityProviderConfig
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_config */
        1:
          message.identityProviderConfig = IdentityProviderConfig.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.identityProviderConfig
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderConfig)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfig,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const CreateIdentityProviderConfigResponse = new CreateIdentityProviderConfigResponse$Type();
class GetIdentityProviderConfigRequest$Type extends MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.admin.GetIdentityProviderConfigRequest", [
      {
        no: 1,
        name: "identity_provider_id",
        kind: "scalar",
        T: 9
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.identityProviderId = "";
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string identity_provider_id */
        1:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderId !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetIdentityProviderConfigRequest = new GetIdentityProviderConfigRequest$Type();
class GetIdentityProviderConfigResponse$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.GetIdentityProviderConfigResponse",
      [
        {
          no: 1,
          name: "identity_provider_config",
          kind: "message",
          T: () => IdentityProviderConfig
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_config */
        1:
          message.identityProviderConfig = IdentityProviderConfig.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.identityProviderConfig
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderConfig)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfig,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetIdentityProviderConfigResponse = new GetIdentityProviderConfigResponse$Type();
class ListIdentityProviderConfigsRequest$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.ListIdentityProviderConfigsRequest",
      []
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListIdentityProviderConfigsRequest = new ListIdentityProviderConfigsRequest$Type();
class ListIdentityProviderConfigsResponse$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.ListIdentityProviderConfigsResponse",
      [
        {
          no: 1,
          name: "identity_provider_configs",
          kind: "message",
          repeat: 2,
          T: () => IdentityProviderConfig
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.identityProviderConfigs = [];
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* repeated com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_configs */
        1:
          message.identityProviderConfigs.push(
            IdentityProviderConfig.internalBinaryRead(
              reader,
              reader.uint32(),
              options
            )
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    for (let i = 0; i < message.identityProviderConfigs.length; i++)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfigs[i],
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const ListIdentityProviderConfigsResponse = new ListIdentityProviderConfigsResponse$Type();
class UpdateIdentityProviderConfigRequest$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.UpdateIdentityProviderConfigRequest",
      [
        {
          no: 1,
          name: "identity_provider_config",
          kind: "message",
          T: () => IdentityProviderConfig
        },
        {
          no: 2,
          name: "update_mask",
          kind: "message",
          T: () => FieldMask
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_config */
        1:
          message.identityProviderConfig = IdentityProviderConfig.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.identityProviderConfig
          );
          break;
        case /* google.protobuf.FieldMask update_mask */
        2:
          message.updateMask = FieldMask.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.updateMask
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderConfig)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfig,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.updateMask)
      FieldMask.internalBinaryWrite(
        message.updateMask,
        writer.tag(2, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateIdentityProviderConfigRequest = new UpdateIdentityProviderConfigRequest$Type();
class UpdateIdentityProviderConfigResponse$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.UpdateIdentityProviderConfigResponse",
      [
        {
          no: 1,
          name: "identity_provider_config",
          kind: "message",
          T: () => IdentityProviderConfig
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.admin.IdentityProviderConfig identity_provider_config */
        1:
          message.identityProviderConfig = IdentityProviderConfig.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.identityProviderConfig
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderConfig)
      IdentityProviderConfig.internalBinaryWrite(
        message.identityProviderConfig,
        writer.tag(1, WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const UpdateIdentityProviderConfigResponse = new UpdateIdentityProviderConfigResponse$Type();
class DeleteIdentityProviderConfigRequest$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.DeleteIdentityProviderConfigRequest",
      [
        {
          no: 1,
          name: "identity_provider_id",
          kind: "scalar",
          T: 9
        }
      ]
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.identityProviderId = "";
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string identity_provider_id */
        1:
          message.identityProviderId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.identityProviderId !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.identityProviderId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const DeleteIdentityProviderConfigRequest = new DeleteIdentityProviderConfigRequest$Type();
class DeleteIdentityProviderConfigResponse$Type extends MessageType {
  constructor() {
    super(
      "com.daml.ledger.api.v2.admin.DeleteIdentityProviderConfigResponse",
      []
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      reflectionMergePartial(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const DeleteIdentityProviderConfigResponse = new DeleteIdentityProviderConfigResponse$Type();
const IdentityProviderConfigService = new ServiceType(
  "com.daml.ledger.api.v2.admin.IdentityProviderConfigService",
  [
    {
      name: "CreateIdentityProviderConfig",
      options: {},
      I: CreateIdentityProviderConfigRequest,
      O: CreateIdentityProviderConfigResponse
    },
    {
      name: "GetIdentityProviderConfig",
      options: {},
      I: GetIdentityProviderConfigRequest,
      O: GetIdentityProviderConfigResponse
    },
    {
      name: "UpdateIdentityProviderConfig",
      options: {},
      I: UpdateIdentityProviderConfigRequest,
      O: UpdateIdentityProviderConfigResponse
    },
    {
      name: "ListIdentityProviderConfigs",
      options: {},
      I: ListIdentityProviderConfigsRequest,
      O: ListIdentityProviderConfigsResponse
    },
    {
      name: "DeleteIdentityProviderConfig",
      options: {},
      I: DeleteIdentityProviderConfigRequest,
      O: DeleteIdentityProviderConfigResponse
    }
  ]
);
export {
  CreateIdentityProviderConfigRequest,
  CreateIdentityProviderConfigResponse,
  DeleteIdentityProviderConfigRequest,
  DeleteIdentityProviderConfigResponse,
  GetIdentityProviderConfigRequest,
  GetIdentityProviderConfigResponse,
  IdentityProviderConfig,
  IdentityProviderConfigService,
  ListIdentityProviderConfigsRequest,
  ListIdentityProviderConfigsResponse,
  UpdateIdentityProviderConfigRequest,
  UpdateIdentityProviderConfigResponse
};
//# sourceMappingURL=identity_provider_config_service.js.map