// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.6.1
//   protoc               unknown
// source: events_mono/common/v1/auth.proto

/* eslint-disable */

/** PublicApiAuth contains authentication context automatically injected by the API */
export interface PublicApiAuth {
  account_id?: number | undefined
  organization_uuid?: string | undefined
  account_uuid?: string | undefined
}

function createBasePublicApiAuth(): PublicApiAuth {
  return { account_id: 0, organization_uuid: '', account_uuid: '' }
}

export const PublicApiAuth: MessageFns<PublicApiAuth> = {
  fromJSON(object: any): PublicApiAuth {
    return {
      account_id: isSet(object.account_id)
        ? globalThis.Number(object.account_id)
        : 0,
      organization_uuid: isSet(object.organization_uuid)
        ? globalThis.String(object.organization_uuid)
        : '',
      account_uuid: isSet(object.account_uuid)
        ? globalThis.String(object.account_uuid)
        : '',
    }
  },

  toJSON(message: PublicApiAuth): unknown {
    const obj: any = {}
    if (message.account_id !== undefined) {
      obj.account_id = Math.round(message.account_id)
    }
    if (message.organization_uuid !== undefined) {
      obj.organization_uuid = message.organization_uuid
    }
    if (message.account_uuid !== undefined) {
      obj.account_uuid = message.account_uuid
    }
    return obj
  },

  create<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
    base?: I,
  ): PublicApiAuth {
    return PublicApiAuth.fromPartial(base ?? ({} as any))
  },
  fromPartial<I extends Exact<DeepPartial<PublicApiAuth>, I>>(
    object: I,
  ): PublicApiAuth {
    const message = createBasePublicApiAuth()
    message.account_id = object.account_id ?? 0
    message.organization_uuid = object.organization_uuid ?? ''
    message.account_uuid = object.account_uuid ?? ''
    return message
  },
}

type Builtin =
  | Date
  | Function
  | Uint8Array
  | string
  | number
  | boolean
  | 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> {
  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
}
