// @generated by protobuf-ts 2.8.2
// @generated from protobuf file "dashboard.proto" (package "gooseai", syntax proto3)
// tslint:disable
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
/**
 * @generated from protobuf message gooseai.OrganizationMember
 */
export interface OrganizationMember {
    /**
     * @generated from protobuf field: gooseai.Organization organization = 1;
     */
    organization?: Organization;
    /**
     * @generated from protobuf field: optional gooseai.User user = 2;
     */
    user?: User;
    /**
     * @generated from protobuf field: gooseai.OrganizationRole role = 3;
     */
    role: OrganizationRole;
    /**
     * @generated from protobuf field: bool is_default = 4;
     */
    isDefault: boolean;
}
/**
 * @generated from protobuf message gooseai.OrganizationGrant
 */
export interface OrganizationGrant {
    /**
     * @generated from protobuf field: double amount_granted = 1;
     */
    amountGranted: number;
    /**
     * @generated from protobuf field: double amount_used = 2;
     */
    amountUsed: number;
    /**
     * @generated from protobuf field: uint64 expires_at = 3;
     */
    expiresAt: bigint;
    /**
     * @generated from protobuf field: uint64 granted_at = 4;
     */
    grantedAt: bigint;
}
/**
 * @generated from protobuf message gooseai.OrganizationPaymentInfo
 */
export interface OrganizationPaymentInfo {
    /**
     * @generated from protobuf field: double balance = 1;
     */
    balance: number;
    /**
     * @generated from protobuf field: repeated gooseai.OrganizationGrant grants = 2;
     */
    grants: OrganizationGrant[];
}
/**
 * @generated from protobuf message gooseai.OrganizationAutoCharge
 */
export interface OrganizationAutoCharge {
    /**
     * @generated from protobuf field: bool enabled = 1;
     */
    enabled: boolean;
    /**
     * @generated from protobuf field: string id = 2;
     */
    id: string;
    /**
     * @generated from protobuf field: uint64 created_at = 3;
     */
    createdAt: bigint;
}
/**
 * @generated from protobuf message gooseai.Organization
 */
export interface Organization {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
    /**
     * @generated from protobuf field: string name = 2;
     */
    name: string;
    /**
     * @generated from protobuf field: string description = 3;
     */
    description: string;
    /**
     * @generated from protobuf field: repeated gooseai.OrganizationMember members = 4;
     */
    members: OrganizationMember[];
    /**
     * @generated from protobuf field: optional gooseai.OrganizationPaymentInfo payment_info = 5;
     */
    paymentInfo?: OrganizationPaymentInfo;
    /**
     * @generated from protobuf field: optional string stripe_customer_id = 6;
     */
    stripeCustomerId?: string;
    /**
     * @generated from protobuf field: optional gooseai.OrganizationAutoCharge auto_charge = 7;
     */
    autoCharge?: OrganizationAutoCharge;
}
/**
 * @generated from protobuf message gooseai.APIKey
 */
export interface APIKey {
    /**
     * @generated from protobuf field: string key = 1;
     */
    key: string;
    /**
     * @generated from protobuf field: bool is_secret = 2;
     */
    isSecret: boolean;
    /**
     * @generated from protobuf field: uint64 created_at = 3;
     */
    createdAt: bigint;
}
/**
 * @generated from protobuf message gooseai.User
 */
export interface User {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
    /**
     * @generated from protobuf field: optional string auth_id = 2;
     */
    authId?: string;
    /**
     * @generated from protobuf field: string profile_picture = 3;
     */
    profilePicture: string;
    /**
     * @generated from protobuf field: string email = 4;
     */
    email: string;
    /**
     * @generated from protobuf field: repeated gooseai.OrganizationMember organizations = 5;
     */
    organizations: OrganizationMember[];
    /**
     * @generated from protobuf field: repeated gooseai.APIKey api_keys = 7;
     */
    apiKeys: APIKey[];
    /**
     * @generated from protobuf field: uint64 created_at = 8;
     */
    createdAt: bigint;
    /**
     * @generated from protobuf field: optional bool email_verified = 9;
     */
    emailVerified?: boolean;
}
/**
 * @generated from protobuf message gooseai.CostData
 */
export interface CostData {
    /**
     * @generated from protobuf field: uint32 amount_tokens = 1;
     */
    amountTokens: number;
    /**
     * @generated from protobuf field: double amount_credits = 2;
     */
    amountCredits: number;
}
/**
 * @generated from protobuf message gooseai.UsageMetric
 */
export interface UsageMetric {
    /**
     * @generated from protobuf field: string operation = 1;
     */
    operation: string;
    /**
     * @generated from protobuf field: string engine = 2;
     */
    engine: string;
    /**
     * @generated from protobuf field: gooseai.CostData input_cost = 3;
     */
    inputCost?: CostData;
    /**
     * @generated from protobuf field: gooseai.CostData output_cost = 4;
     */
    outputCost?: CostData;
    /**
     * @generated from protobuf field: optional string user = 5;
     */
    user?: string;
    /**
     * @generated from protobuf field: uint64 aggregation_timestamp = 6;
     */
    aggregationTimestamp: bigint;
}
/**
 * @generated from protobuf message gooseai.CostTotal
 */
export interface CostTotal {
    /**
     * @generated from protobuf field: uint32 amount_tokens = 1;
     */
    amountTokens: number;
    /**
     * @generated from protobuf field: double amount_credits = 2;
     */
    amountCredits: number;
}
/**
 * @generated from protobuf message gooseai.TotalMetricsData
 */
export interface TotalMetricsData {
    /**
     * @generated from protobuf field: gooseai.CostTotal input_total = 1;
     */
    inputTotal?: CostTotal;
    /**
     * @generated from protobuf field: gooseai.CostTotal output_total = 2;
     */
    outputTotal?: CostTotal;
}
/**
 * @generated from protobuf message gooseai.Metrics
 */
export interface Metrics {
    /**
     * @generated from protobuf field: repeated gooseai.UsageMetric metrics = 1;
     */
    metrics: UsageMetric[];
    /**
     * @generated from protobuf field: gooseai.TotalMetricsData total = 2;
     */
    total?: TotalMetricsData;
}
/**
 * @generated from protobuf message gooseai.EmptyRequest
 */
export interface EmptyRequest {
}
/**
 * @generated from protobuf message gooseai.GetOrganizationRequest
 */
export interface GetOrganizationRequest {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
}
/**
 * @generated from protobuf message gooseai.GetMetricsRequest
 */
export interface GetMetricsRequest {
    /**
     * @generated from protobuf field: string organization_id = 1;
     */
    organizationId: string;
    /**
     * @generated from protobuf field: optional string user_id = 2;
     */
    userId?: string;
    /**
     * @generated from protobuf field: uint64 range_from = 3;
     */
    rangeFrom: bigint;
    /**
     * @generated from protobuf field: uint64 range_to = 4;
     */
    rangeTo: bigint;
    /**
     * @generated from protobuf field: bool include_per_request_metrics = 5;
     */
    includePerRequestMetrics: boolean;
}
/**
 * @generated from protobuf message gooseai.APIKeyRequest
 */
export interface APIKeyRequest {
    /**
     * @generated from protobuf field: bool is_secret = 1;
     */
    isSecret: boolean;
}
/**
 * @generated from protobuf message gooseai.APIKeyFindRequest
 */
export interface APIKeyFindRequest {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
}
/**
 * @generated from protobuf message gooseai.UpdateDefaultOrganizationRequest
 */
export interface UpdateDefaultOrganizationRequest {
    /**
     * @generated from protobuf field: string organization_id = 1;
     */
    organizationId: string;
}
/**
 * @generated from protobuf message gooseai.ClientSettings
 */
export interface ClientSettings {
    /**
     * @generated from protobuf field: bytes settings = 1;
     */
    settings: Uint8Array;
}
/**
 * @generated from protobuf message gooseai.CreateAutoChargeIntentRequest
 */
export interface CreateAutoChargeIntentRequest {
    /**
     * @generated from protobuf field: string organization_id = 1;
     */
    organizationId: string;
    /**
     * @generated from protobuf field: uint64 monthly_maximum = 2;
     */
    monthlyMaximum: bigint;
    /**
     * @generated from protobuf field: uint64 minimum_value = 3;
     */
    minimumValue: bigint;
    /**
     * @generated from protobuf field: uint64 amount_credits = 4;
     */
    amountCredits: bigint;
}
/**
 * @generated from protobuf message gooseai.CreateChargeRequest
 */
export interface CreateChargeRequest {
    /**
     * @generated from protobuf field: uint64 amount = 1;
     */
    amount: bigint;
    /**
     * @generated from protobuf field: string organization_id = 2;
     */
    organizationId: string;
}
/**
 * @generated from protobuf message gooseai.GetChargesRequest
 */
export interface GetChargesRequest {
    /**
     * @generated from protobuf field: string organization_id = 1;
     */
    organizationId: string;
    /**
     * @generated from protobuf field: uint64 range_from = 2;
     */
    rangeFrom: bigint;
    /**
     * @generated from protobuf field: uint64 range_to = 3;
     */
    rangeTo: bigint;
}
/**
 * @generated from protobuf message gooseai.Charge
 */
export interface Charge {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
    /**
     * @generated from protobuf field: bool paid = 2;
     */
    paid: boolean;
    /**
     * @generated from protobuf field: string receipt_link = 3;
     */
    receiptLink: string;
    /**
     * @generated from protobuf field: string payment_link = 4;
     */
    paymentLink: string;
    /**
     * @generated from protobuf field: uint64 created_at = 5;
     */
    createdAt: bigint;
    /**
     * @generated from protobuf field: uint64 amount_credits = 6;
     */
    amountCredits: bigint;
}
/**
 * @generated from protobuf message gooseai.Charges
 */
export interface Charges {
    /**
     * @generated from protobuf field: repeated gooseai.Charge charges = 1;
     */
    charges: Charge[];
}
/**
 * @generated from protobuf message gooseai.GetAutoChargeRequest
 */
export interface GetAutoChargeRequest {
    /**
     * @generated from protobuf field: string organization_id = 1;
     */
    organizationId: string;
}
/**
 * @generated from protobuf message gooseai.AutoChargeIntent
 */
export interface AutoChargeIntent {
    /**
     * @generated from protobuf field: string id = 1;
     */
    id: string;
    /**
     * @generated from protobuf field: string payment_link = 2;
     */
    paymentLink: string;
    /**
     * @generated from protobuf field: uint64 created_at = 3;
     */
    createdAt: bigint;
    /**
     * @generated from protobuf field: uint64 monthly_maximum = 4;
     */
    monthlyMaximum: bigint;
    /**
     * @generated from protobuf field: uint64 minimum_value = 5;
     */
    minimumValue: bigint;
    /**
     * @generated from protobuf field: uint64 amount_credits = 6;
     */
    amountCredits: bigint;
}
/**
 * @generated from protobuf message gooseai.UpdateUserInfoRequest
 */
export interface UpdateUserInfoRequest {
    /**
     * @generated from protobuf field: optional string email = 1;
     */
    email?: string;
}
/**
 * @generated from protobuf message gooseai.UserPasswordChangeTicket
 */
export interface UserPasswordChangeTicket {
    /**
     * @generated from protobuf field: string ticket = 1;
     */
    ticket: string;
}
/**
 * @generated from protobuf enum gooseai.OrganizationRole
 */
export enum OrganizationRole {
    /**
     * @generated from protobuf enum value: MEMBER = 0;
     */
    MEMBER = 0,
    /**
     * @generated from protobuf enum value: ACCOUNTANT = 1;
     */
    ACCOUNTANT = 1,
    /**
     * @generated from protobuf enum value: OWNER = 2;
     */
    OWNER = 2
}
// @generated message type with reflection information, may provide speed optimized methods
class OrganizationMember$Type extends MessageType<OrganizationMember> {
    constructor() {
        super("gooseai.OrganizationMember", [
            { no: 1, name: "organization", kind: "message", T: () => Organization },
            { no: 2, name: "user", kind: "message", T: () => User },
            { no: 3, name: "role", kind: "enum", T: () => ["gooseai.OrganizationRole", OrganizationRole] },
            { no: 4, name: "is_default", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value?: PartialMessage<OrganizationMember>): OrganizationMember {
        const message = { role: 0, isDefault: false };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<OrganizationMember>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrganizationMember): OrganizationMember {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* gooseai.Organization organization */ 1:
                    message.organization = Organization.internalBinaryRead(reader, reader.uint32(), options, message.organization);
                    break;
                case /* optional gooseai.User user */ 2:
                    message.user = User.internalBinaryRead(reader, reader.uint32(), options, message.user);
                    break;
                case /* gooseai.OrganizationRole role */ 3:
                    message.role = reader.int32();
                    break;
                case /* bool is_default */ 4:
                    message.isDefault = reader.bool();
                    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: OrganizationMember, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* gooseai.Organization organization = 1; */
        if (message.organization)
            Organization.internalBinaryWrite(message.organization, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* optional gooseai.User user = 2; */
        if (message.user)
            User.internalBinaryWrite(message.user, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* gooseai.OrganizationRole role = 3; */
        if (message.role !== 0)
            writer.tag(3, WireType.Varint).int32(message.role);
        /* bool is_default = 4; */
        if (message.isDefault !== false)
            writer.tag(4, WireType.Varint).bool(message.isDefault);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.OrganizationMember
 */
export const OrganizationMember = new OrganizationMember$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OrganizationGrant$Type extends MessageType<OrganizationGrant> {
    constructor() {
        super("gooseai.OrganizationGrant", [
            { no: 1, name: "amount_granted", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ },
            { no: 2, name: "amount_used", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ },
            { no: 3, name: "expires_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 4, name: "granted_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<OrganizationGrant>): OrganizationGrant {
        const message = { amountGranted: 0, amountUsed: 0, expiresAt: 0n, grantedAt: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<OrganizationGrant>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrganizationGrant): OrganizationGrant {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* double amount_granted */ 1:
                    message.amountGranted = reader.double();
                    break;
                case /* double amount_used */ 2:
                    message.amountUsed = reader.double();
                    break;
                case /* uint64 expires_at */ 3:
                    message.expiresAt = reader.uint64().toBigInt();
                    break;
                case /* uint64 granted_at */ 4:
                    message.grantedAt = reader.uint64().toBigInt();
                    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: OrganizationGrant, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* double amount_granted = 1; */
        if (message.amountGranted !== 0)
            writer.tag(1, WireType.Bit64).double(message.amountGranted);
        /* double amount_used = 2; */
        if (message.amountUsed !== 0)
            writer.tag(2, WireType.Bit64).double(message.amountUsed);
        /* uint64 expires_at = 3; */
        if (message.expiresAt !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.expiresAt);
        /* uint64 granted_at = 4; */
        if (message.grantedAt !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.grantedAt);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.OrganizationGrant
 */
export const OrganizationGrant = new OrganizationGrant$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OrganizationPaymentInfo$Type extends MessageType<OrganizationPaymentInfo> {
    constructor() {
        super("gooseai.OrganizationPaymentInfo", [
            { no: 1, name: "balance", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ },
            { no: 2, name: "grants", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => OrganizationGrant }
        ]);
    }
    create(value?: PartialMessage<OrganizationPaymentInfo>): OrganizationPaymentInfo {
        const message = { balance: 0, grants: [] };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<OrganizationPaymentInfo>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrganizationPaymentInfo): OrganizationPaymentInfo {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* double balance */ 1:
                    message.balance = reader.double();
                    break;
                case /* repeated gooseai.OrganizationGrant grants */ 2:
                    message.grants.push(OrganizationGrant.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: OrganizationPaymentInfo, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* double balance = 1; */
        if (message.balance !== 0)
            writer.tag(1, WireType.Bit64).double(message.balance);
        /* repeated gooseai.OrganizationGrant grants = 2; */
        for (let i = 0; i < message.grants.length; i++)
            OrganizationGrant.internalBinaryWrite(message.grants[i], 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;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.OrganizationPaymentInfo
 */
export const OrganizationPaymentInfo = new OrganizationPaymentInfo$Type();
// @generated message type with reflection information, may provide speed optimized methods
class OrganizationAutoCharge$Type extends MessageType<OrganizationAutoCharge> {
    constructor() {
        super("gooseai.OrganizationAutoCharge", [
            { no: 1, name: "enabled", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 2, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "created_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<OrganizationAutoCharge>): OrganizationAutoCharge {
        const message = { enabled: false, id: "", createdAt: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<OrganizationAutoCharge>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OrganizationAutoCharge): OrganizationAutoCharge {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bool enabled */ 1:
                    message.enabled = reader.bool();
                    break;
                case /* string id */ 2:
                    message.id = reader.string();
                    break;
                case /* uint64 created_at */ 3:
                    message.createdAt = reader.uint64().toBigInt();
                    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: OrganizationAutoCharge, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* bool enabled = 1; */
        if (message.enabled !== false)
            writer.tag(1, WireType.Varint).bool(message.enabled);
        /* string id = 2; */
        if (message.id !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.id);
        /* uint64 created_at = 3; */
        if (message.createdAt !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.createdAt);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.OrganizationAutoCharge
 */
export const OrganizationAutoCharge = new OrganizationAutoCharge$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Organization$Type extends MessageType<Organization> {
    constructor() {
        super("gooseai.Organization", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "members", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => OrganizationMember },
            { no: 5, name: "payment_info", kind: "message", T: () => OrganizationPaymentInfo },
            { no: 6, name: "stripe_customer_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "auto_charge", kind: "message", T: () => OrganizationAutoCharge }
        ]);
    }
    create(value?: PartialMessage<Organization>): Organization {
        const message = { id: "", name: "", description: "", members: [] };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<Organization>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Organization): Organization {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = reader.string();
                    break;
                case /* string name */ 2:
                    message.name = reader.string();
                    break;
                case /* string description */ 3:
                    message.description = reader.string();
                    break;
                case /* repeated gooseai.OrganizationMember members */ 4:
                    message.members.push(OrganizationMember.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* optional gooseai.OrganizationPaymentInfo payment_info */ 5:
                    message.paymentInfo = OrganizationPaymentInfo.internalBinaryRead(reader, reader.uint32(), options, message.paymentInfo);
                    break;
                case /* optional string stripe_customer_id */ 6:
                    message.stripeCustomerId = reader.string();
                    break;
                case /* optional gooseai.OrganizationAutoCharge auto_charge */ 7:
                    message.autoCharge = OrganizationAutoCharge.internalBinaryRead(reader, reader.uint32(), options, message.autoCharge);
                    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: Organization, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        /* string name = 2; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string description = 3; */
        if (message.description !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.description);
        /* repeated gooseai.OrganizationMember members = 4; */
        for (let i = 0; i < message.members.length; i++)
            OrganizationMember.internalBinaryWrite(message.members[i], writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* optional gooseai.OrganizationPaymentInfo payment_info = 5; */
        if (message.paymentInfo)
            OrganizationPaymentInfo.internalBinaryWrite(message.paymentInfo, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* optional string stripe_customer_id = 6; */
        if (message.stripeCustomerId !== undefined)
            writer.tag(6, WireType.LengthDelimited).string(message.stripeCustomerId);
        /* optional gooseai.OrganizationAutoCharge auto_charge = 7; */
        if (message.autoCharge)
            OrganizationAutoCharge.internalBinaryWrite(message.autoCharge, writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.Organization
 */
export const Organization = new Organization$Type();
// @generated message type with reflection information, may provide speed optimized methods
class APIKey$Type extends MessageType<APIKey> {
    constructor() {
        super("gooseai.APIKey", [
            { no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "is_secret", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "created_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<APIKey>): APIKey {
        const message = { key: "", isSecret: false, createdAt: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<APIKey>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: APIKey): APIKey {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string key */ 1:
                    message.key = reader.string();
                    break;
                case /* bool is_secret */ 2:
                    message.isSecret = reader.bool();
                    break;
                case /* uint64 created_at */ 3:
                    message.createdAt = reader.uint64().toBigInt();
                    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: APIKey, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string key = 1; */
        if (message.key !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.key);
        /* bool is_secret = 2; */
        if (message.isSecret !== false)
            writer.tag(2, WireType.Varint).bool(message.isSecret);
        /* uint64 created_at = 3; */
        if (message.createdAt !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.createdAt);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.APIKey
 */
export const APIKey = new APIKey$Type();
// @generated message type with reflection information, may provide speed optimized methods
class User$Type extends MessageType<User> {
    constructor() {
        super("gooseai.User", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "auth_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "profile_picture", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "email", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "organizations", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => OrganizationMember },
            { no: 7, name: "api_keys", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => APIKey },
            { no: 8, name: "created_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 9, name: "email_verified", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value?: PartialMessage<User>): User {
        const message = { id: "", profilePicture: "", email: "", organizations: [], apiKeys: [], createdAt: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<User>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: User): User {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = reader.string();
                    break;
                case /* optional string auth_id */ 2:
                    message.authId = reader.string();
                    break;
                case /* string profile_picture */ 3:
                    message.profilePicture = reader.string();
                    break;
                case /* string email */ 4:
                    message.email = reader.string();
                    break;
                case /* repeated gooseai.OrganizationMember organizations */ 5:
                    message.organizations.push(OrganizationMember.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated gooseai.APIKey api_keys */ 7:
                    message.apiKeys.push(APIKey.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* uint64 created_at */ 8:
                    message.createdAt = reader.uint64().toBigInt();
                    break;
                case /* optional bool email_verified */ 9:
                    message.emailVerified = reader.bool();
                    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: User, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        /* optional string auth_id = 2; */
        if (message.authId !== undefined)
            writer.tag(2, WireType.LengthDelimited).string(message.authId);
        /* string profile_picture = 3; */
        if (message.profilePicture !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.profilePicture);
        /* string email = 4; */
        if (message.email !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.email);
        /* repeated gooseai.OrganizationMember organizations = 5; */
        for (let i = 0; i < message.organizations.length; i++)
            OrganizationMember.internalBinaryWrite(message.organizations[i], writer.tag(5, WireType.LengthDelimited).fork(), options).join();
        /* repeated gooseai.APIKey api_keys = 7; */
        for (let i = 0; i < message.apiKeys.length; i++)
            APIKey.internalBinaryWrite(message.apiKeys[i], writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* uint64 created_at = 8; */
        if (message.createdAt !== 0n)
            writer.tag(8, WireType.Varint).uint64(message.createdAt);
        /* optional bool email_verified = 9; */
        if (message.emailVerified !== undefined)
            writer.tag(9, WireType.Varint).bool(message.emailVerified);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.User
 */
export const User = new User$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CostData$Type extends MessageType<CostData> {
    constructor() {
        super("gooseai.CostData", [
            { no: 1, name: "amount_tokens", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
            { no: 2, name: "amount_credits", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }
        ]);
    }
    create(value?: PartialMessage<CostData>): CostData {
        const message = { amountTokens: 0, amountCredits: 0 };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<CostData>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CostData): CostData {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint32 amount_tokens */ 1:
                    message.amountTokens = reader.uint32();
                    break;
                case /* double amount_credits */ 2:
                    message.amountCredits = reader.double();
                    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: CostData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* uint32 amount_tokens = 1; */
        if (message.amountTokens !== 0)
            writer.tag(1, WireType.Varint).uint32(message.amountTokens);
        /* double amount_credits = 2; */
        if (message.amountCredits !== 0)
            writer.tag(2, WireType.Bit64).double(message.amountCredits);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.CostData
 */
export const CostData = new CostData$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UsageMetric$Type extends MessageType<UsageMetric> {
    constructor() {
        super("gooseai.UsageMetric", [
            { no: 1, name: "operation", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "engine", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "input_cost", kind: "message", T: () => CostData },
            { no: 4, name: "output_cost", kind: "message", T: () => CostData },
            { no: 5, name: "user", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "aggregation_timestamp", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<UsageMetric>): UsageMetric {
        const message = { operation: "", engine: "", aggregationTimestamp: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<UsageMetric>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UsageMetric): UsageMetric {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string operation */ 1:
                    message.operation = reader.string();
                    break;
                case /* string engine */ 2:
                    message.engine = reader.string();
                    break;
                case /* gooseai.CostData input_cost */ 3:
                    message.inputCost = CostData.internalBinaryRead(reader, reader.uint32(), options, message.inputCost);
                    break;
                case /* gooseai.CostData output_cost */ 4:
                    message.outputCost = CostData.internalBinaryRead(reader, reader.uint32(), options, message.outputCost);
                    break;
                case /* optional string user */ 5:
                    message.user = reader.string();
                    break;
                case /* uint64 aggregation_timestamp */ 6:
                    message.aggregationTimestamp = reader.uint64().toBigInt();
                    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: UsageMetric, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string operation = 1; */
        if (message.operation !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.operation);
        /* string engine = 2; */
        if (message.engine !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.engine);
        /* gooseai.CostData input_cost = 3; */
        if (message.inputCost)
            CostData.internalBinaryWrite(message.inputCost, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* gooseai.CostData output_cost = 4; */
        if (message.outputCost)
            CostData.internalBinaryWrite(message.outputCost, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* optional string user = 5; */
        if (message.user !== undefined)
            writer.tag(5, WireType.LengthDelimited).string(message.user);
        /* uint64 aggregation_timestamp = 6; */
        if (message.aggregationTimestamp !== 0n)
            writer.tag(6, WireType.Varint).uint64(message.aggregationTimestamp);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.UsageMetric
 */
export const UsageMetric = new UsageMetric$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CostTotal$Type extends MessageType<CostTotal> {
    constructor() {
        super("gooseai.CostTotal", [
            { no: 1, name: "amount_tokens", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
            { no: 2, name: "amount_credits", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }
        ]);
    }
    create(value?: PartialMessage<CostTotal>): CostTotal {
        const message = { amountTokens: 0, amountCredits: 0 };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<CostTotal>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CostTotal): CostTotal {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint32 amount_tokens */ 1:
                    message.amountTokens = reader.uint32();
                    break;
                case /* double amount_credits */ 2:
                    message.amountCredits = reader.double();
                    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: CostTotal, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* uint32 amount_tokens = 1; */
        if (message.amountTokens !== 0)
            writer.tag(1, WireType.Varint).uint32(message.amountTokens);
        /* double amount_credits = 2; */
        if (message.amountCredits !== 0)
            writer.tag(2, WireType.Bit64).double(message.amountCredits);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.CostTotal
 */
export const CostTotal = new CostTotal$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TotalMetricsData$Type extends MessageType<TotalMetricsData> {
    constructor() {
        super("gooseai.TotalMetricsData", [
            { no: 1, name: "input_total", kind: "message", T: () => CostTotal },
            { no: 2, name: "output_total", kind: "message", T: () => CostTotal }
        ]);
    }
    create(value?: PartialMessage<TotalMetricsData>): TotalMetricsData {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<TotalMetricsData>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TotalMetricsData): TotalMetricsData {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* gooseai.CostTotal input_total */ 1:
                    message.inputTotal = CostTotal.internalBinaryRead(reader, reader.uint32(), options, message.inputTotal);
                    break;
                case /* gooseai.CostTotal output_total */ 2:
                    message.outputTotal = CostTotal.internalBinaryRead(reader, reader.uint32(), options, message.outputTotal);
                    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: TotalMetricsData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* gooseai.CostTotal input_total = 1; */
        if (message.inputTotal)
            CostTotal.internalBinaryWrite(message.inputTotal, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* gooseai.CostTotal output_total = 2; */
        if (message.outputTotal)
            CostTotal.internalBinaryWrite(message.outputTotal, 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;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.TotalMetricsData
 */
export const TotalMetricsData = new TotalMetricsData$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Metrics$Type extends MessageType<Metrics> {
    constructor() {
        super("gooseai.Metrics", [
            { no: 1, name: "metrics", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => UsageMetric },
            { no: 2, name: "total", kind: "message", T: () => TotalMetricsData }
        ]);
    }
    create(value?: PartialMessage<Metrics>): Metrics {
        const message = { metrics: [] };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<Metrics>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Metrics): Metrics {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated gooseai.UsageMetric metrics */ 1:
                    message.metrics.push(UsageMetric.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* gooseai.TotalMetricsData total */ 2:
                    message.total = TotalMetricsData.internalBinaryRead(reader, reader.uint32(), options, message.total);
                    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: Metrics, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated gooseai.UsageMetric metrics = 1; */
        for (let i = 0; i < message.metrics.length; i++)
            UsageMetric.internalBinaryWrite(message.metrics[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* gooseai.TotalMetricsData total = 2; */
        if (message.total)
            TotalMetricsData.internalBinaryWrite(message.total, 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;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.Metrics
 */
export const Metrics = new Metrics$Type();
// @generated message type with reflection information, may provide speed optimized methods
class EmptyRequest$Type extends MessageType<EmptyRequest> {
    constructor() {
        super("gooseai.EmptyRequest", []);
    }
    create(value?: PartialMessage<EmptyRequest>): EmptyRequest {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<EmptyRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: EmptyRequest): EmptyRequest {
        return target ?? this.create();
    }
    internalBinaryWrite(message: EmptyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.EmptyRequest
 */
export const EmptyRequest = new EmptyRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetOrganizationRequest$Type extends MessageType<GetOrganizationRequest> {
    constructor() {
        super("gooseai.GetOrganizationRequest", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<GetOrganizationRequest>): GetOrganizationRequest {
        const message = { id: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<GetOrganizationRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetOrganizationRequest): GetOrganizationRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = 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: GetOrganizationRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.GetOrganizationRequest
 */
export const GetOrganizationRequest = new GetOrganizationRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetMetricsRequest$Type extends MessageType<GetMetricsRequest> {
    constructor() {
        super("gooseai.GetMetricsRequest", [
            { no: 1, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "user_id", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "range_from", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 4, name: "range_to", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 5, name: "include_per_request_metrics", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value?: PartialMessage<GetMetricsRequest>): GetMetricsRequest {
        const message = { organizationId: "", rangeFrom: 0n, rangeTo: 0n, includePerRequestMetrics: false };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<GetMetricsRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetMetricsRequest): GetMetricsRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string organization_id */ 1:
                    message.organizationId = reader.string();
                    break;
                case /* optional string user_id */ 2:
                    message.userId = reader.string();
                    break;
                case /* uint64 range_from */ 3:
                    message.rangeFrom = reader.uint64().toBigInt();
                    break;
                case /* uint64 range_to */ 4:
                    message.rangeTo = reader.uint64().toBigInt();
                    break;
                case /* bool include_per_request_metrics */ 5:
                    message.includePerRequestMetrics = reader.bool();
                    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: GetMetricsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string organization_id = 1; */
        if (message.organizationId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.organizationId);
        /* optional string user_id = 2; */
        if (message.userId !== undefined)
            writer.tag(2, WireType.LengthDelimited).string(message.userId);
        /* uint64 range_from = 3; */
        if (message.rangeFrom !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.rangeFrom);
        /* uint64 range_to = 4; */
        if (message.rangeTo !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.rangeTo);
        /* bool include_per_request_metrics = 5; */
        if (message.includePerRequestMetrics !== false)
            writer.tag(5, WireType.Varint).bool(message.includePerRequestMetrics);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.GetMetricsRequest
 */
export const GetMetricsRequest = new GetMetricsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class APIKeyRequest$Type extends MessageType<APIKeyRequest> {
    constructor() {
        super("gooseai.APIKeyRequest", [
            { no: 1, name: "is_secret", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
        ]);
    }
    create(value?: PartialMessage<APIKeyRequest>): APIKeyRequest {
        const message = { isSecret: false };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<APIKeyRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: APIKeyRequest): APIKeyRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bool is_secret */ 1:
                    message.isSecret = reader.bool();
                    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: APIKeyRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* bool is_secret = 1; */
        if (message.isSecret !== false)
            writer.tag(1, WireType.Varint).bool(message.isSecret);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.APIKeyRequest
 */
export const APIKeyRequest = new APIKeyRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class APIKeyFindRequest$Type extends MessageType<APIKeyFindRequest> {
    constructor() {
        super("gooseai.APIKeyFindRequest", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<APIKeyFindRequest>): APIKeyFindRequest {
        const message = { id: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<APIKeyFindRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: APIKeyFindRequest): APIKeyFindRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = 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: APIKeyFindRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.APIKeyFindRequest
 */
export const APIKeyFindRequest = new APIKeyFindRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UpdateDefaultOrganizationRequest$Type extends MessageType<UpdateDefaultOrganizationRequest> {
    constructor() {
        super("gooseai.UpdateDefaultOrganizationRequest", [
            { no: 1, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<UpdateDefaultOrganizationRequest>): UpdateDefaultOrganizationRequest {
        const message = { organizationId: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<UpdateDefaultOrganizationRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateDefaultOrganizationRequest): UpdateDefaultOrganizationRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string organization_id */ 1:
                    message.organizationId = 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: UpdateDefaultOrganizationRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string organization_id = 1; */
        if (message.organizationId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.organizationId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.UpdateDefaultOrganizationRequest
 */
export const UpdateDefaultOrganizationRequest = new UpdateDefaultOrganizationRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ClientSettings$Type extends MessageType<ClientSettings> {
    constructor() {
        super("gooseai.ClientSettings", [
            { no: 1, name: "settings", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
        ]);
    }
    create(value?: PartialMessage<ClientSettings>): ClientSettings {
        const message = { settings: new Uint8Array(0) };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ClientSettings>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ClientSettings): ClientSettings {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bytes settings */ 1:
                    message.settings = reader.bytes();
                    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: ClientSettings, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* bytes settings = 1; */
        if (message.settings.length)
            writer.tag(1, WireType.LengthDelimited).bytes(message.settings);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.ClientSettings
 */
export const ClientSettings = new ClientSettings$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CreateAutoChargeIntentRequest$Type extends MessageType<CreateAutoChargeIntentRequest> {
    constructor() {
        super("gooseai.CreateAutoChargeIntentRequest", [
            { no: 1, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "monthly_maximum", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 3, name: "minimum_value", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 4, name: "amount_credits", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<CreateAutoChargeIntentRequest>): CreateAutoChargeIntentRequest {
        const message = { organizationId: "", monthlyMaximum: 0n, minimumValue: 0n, amountCredits: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<CreateAutoChargeIntentRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreateAutoChargeIntentRequest): CreateAutoChargeIntentRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string organization_id */ 1:
                    message.organizationId = reader.string();
                    break;
                case /* uint64 monthly_maximum */ 2:
                    message.monthlyMaximum = reader.uint64().toBigInt();
                    break;
                case /* uint64 minimum_value */ 3:
                    message.minimumValue = reader.uint64().toBigInt();
                    break;
                case /* uint64 amount_credits */ 4:
                    message.amountCredits = reader.uint64().toBigInt();
                    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: CreateAutoChargeIntentRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string organization_id = 1; */
        if (message.organizationId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.organizationId);
        /* uint64 monthly_maximum = 2; */
        if (message.monthlyMaximum !== 0n)
            writer.tag(2, WireType.Varint).uint64(message.monthlyMaximum);
        /* uint64 minimum_value = 3; */
        if (message.minimumValue !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.minimumValue);
        /* uint64 amount_credits = 4; */
        if (message.amountCredits !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.amountCredits);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.CreateAutoChargeIntentRequest
 */
export const CreateAutoChargeIntentRequest = new CreateAutoChargeIntentRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CreateChargeRequest$Type extends MessageType<CreateChargeRequest> {
    constructor() {
        super("gooseai.CreateChargeRequest", [
            { no: 1, name: "amount", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 2, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<CreateChargeRequest>): CreateChargeRequest {
        const message = { amount: 0n, organizationId: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<CreateChargeRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreateChargeRequest): CreateChargeRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* uint64 amount */ 1:
                    message.amount = reader.uint64().toBigInt();
                    break;
                case /* string organization_id */ 2:
                    message.organizationId = 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: CreateChargeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* uint64 amount = 1; */
        if (message.amount !== 0n)
            writer.tag(1, WireType.Varint).uint64(message.amount);
        /* string organization_id = 2; */
        if (message.organizationId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.organizationId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.CreateChargeRequest
 */
export const CreateChargeRequest = new CreateChargeRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetChargesRequest$Type extends MessageType<GetChargesRequest> {
    constructor() {
        super("gooseai.GetChargesRequest", [
            { no: 1, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "range_from", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 3, name: "range_to", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<GetChargesRequest>): GetChargesRequest {
        const message = { organizationId: "", rangeFrom: 0n, rangeTo: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<GetChargesRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetChargesRequest): GetChargesRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string organization_id */ 1:
                    message.organizationId = reader.string();
                    break;
                case /* uint64 range_from */ 2:
                    message.rangeFrom = reader.uint64().toBigInt();
                    break;
                case /* uint64 range_to */ 3:
                    message.rangeTo = reader.uint64().toBigInt();
                    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: GetChargesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string organization_id = 1; */
        if (message.organizationId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.organizationId);
        /* uint64 range_from = 2; */
        if (message.rangeFrom !== 0n)
            writer.tag(2, WireType.Varint).uint64(message.rangeFrom);
        /* uint64 range_to = 3; */
        if (message.rangeTo !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.rangeTo);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.GetChargesRequest
 */
export const GetChargesRequest = new GetChargesRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Charge$Type extends MessageType<Charge> {
    constructor() {
        super("gooseai.Charge", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "paid", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
            { no: 3, name: "receipt_link", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "payment_link", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "created_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 6, name: "amount_credits", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<Charge>): Charge {
        const message = { id: "", paid: false, receiptLink: "", paymentLink: "", createdAt: 0n, amountCredits: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<Charge>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Charge): Charge {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = reader.string();
                    break;
                case /* bool paid */ 2:
                    message.paid = reader.bool();
                    break;
                case /* string receipt_link */ 3:
                    message.receiptLink = reader.string();
                    break;
                case /* string payment_link */ 4:
                    message.paymentLink = reader.string();
                    break;
                case /* uint64 created_at */ 5:
                    message.createdAt = reader.uint64().toBigInt();
                    break;
                case /* uint64 amount_credits */ 6:
                    message.amountCredits = reader.uint64().toBigInt();
                    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: Charge, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        /* bool paid = 2; */
        if (message.paid !== false)
            writer.tag(2, WireType.Varint).bool(message.paid);
        /* string receipt_link = 3; */
        if (message.receiptLink !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.receiptLink);
        /* string payment_link = 4; */
        if (message.paymentLink !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.paymentLink);
        /* uint64 created_at = 5; */
        if (message.createdAt !== 0n)
            writer.tag(5, WireType.Varint).uint64(message.createdAt);
        /* uint64 amount_credits = 6; */
        if (message.amountCredits !== 0n)
            writer.tag(6, WireType.Varint).uint64(message.amountCredits);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.Charge
 */
export const Charge = new Charge$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Charges$Type extends MessageType<Charges> {
    constructor() {
        super("gooseai.Charges", [
            { no: 1, name: "charges", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Charge }
        ]);
    }
    create(value?: PartialMessage<Charges>): Charges {
        const message = { charges: [] };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<Charges>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Charges): Charges {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated gooseai.Charge charges */ 1:
                    message.charges.push(Charge.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: Charges, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* repeated gooseai.Charge charges = 1; */
        for (let i = 0; i < message.charges.length; i++)
            Charge.internalBinaryWrite(message.charges[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;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.Charges
 */
export const Charges = new Charges$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetAutoChargeRequest$Type extends MessageType<GetAutoChargeRequest> {
    constructor() {
        super("gooseai.GetAutoChargeRequest", [
            { no: 1, name: "organization_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<GetAutoChargeRequest>): GetAutoChargeRequest {
        const message = { organizationId: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<GetAutoChargeRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: GetAutoChargeRequest): GetAutoChargeRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string organization_id */ 1:
                    message.organizationId = 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: GetAutoChargeRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string organization_id = 1; */
        if (message.organizationId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.organizationId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.GetAutoChargeRequest
 */
export const GetAutoChargeRequest = new GetAutoChargeRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AutoChargeIntent$Type extends MessageType<AutoChargeIntent> {
    constructor() {
        super("gooseai.AutoChargeIntent", [
            { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "payment_link", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "created_at", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 4, name: "monthly_maximum", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 5, name: "minimum_value", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
            { no: 6, name: "amount_credits", kind: "scalar", T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ }
        ]);
    }
    create(value?: PartialMessage<AutoChargeIntent>): AutoChargeIntent {
        const message = { id: "", paymentLink: "", createdAt: 0n, monthlyMaximum: 0n, minimumValue: 0n, amountCredits: 0n };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<AutoChargeIntent>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AutoChargeIntent): AutoChargeIntent {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string id */ 1:
                    message.id = reader.string();
                    break;
                case /* string payment_link */ 2:
                    message.paymentLink = reader.string();
                    break;
                case /* uint64 created_at */ 3:
                    message.createdAt = reader.uint64().toBigInt();
                    break;
                case /* uint64 monthly_maximum */ 4:
                    message.monthlyMaximum = reader.uint64().toBigInt();
                    break;
                case /* uint64 minimum_value */ 5:
                    message.minimumValue = reader.uint64().toBigInt();
                    break;
                case /* uint64 amount_credits */ 6:
                    message.amountCredits = reader.uint64().toBigInt();
                    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: AutoChargeIntent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string id = 1; */
        if (message.id !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.id);
        /* string payment_link = 2; */
        if (message.paymentLink !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.paymentLink);
        /* uint64 created_at = 3; */
        if (message.createdAt !== 0n)
            writer.tag(3, WireType.Varint).uint64(message.createdAt);
        /* uint64 monthly_maximum = 4; */
        if (message.monthlyMaximum !== 0n)
            writer.tag(4, WireType.Varint).uint64(message.monthlyMaximum);
        /* uint64 minimum_value = 5; */
        if (message.minimumValue !== 0n)
            writer.tag(5, WireType.Varint).uint64(message.minimumValue);
        /* uint64 amount_credits = 6; */
        if (message.amountCredits !== 0n)
            writer.tag(6, WireType.Varint).uint64(message.amountCredits);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.AutoChargeIntent
 */
export const AutoChargeIntent = new AutoChargeIntent$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UpdateUserInfoRequest$Type extends MessageType<UpdateUserInfoRequest> {
    constructor() {
        super("gooseai.UpdateUserInfoRequest", [
            { no: 1, name: "email", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<UpdateUserInfoRequest>): UpdateUserInfoRequest {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<UpdateUserInfoRequest>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UpdateUserInfoRequest): UpdateUserInfoRequest {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* optional string email */ 1:
                    message.email = 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: UpdateUserInfoRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* optional string email = 1; */
        if (message.email !== undefined)
            writer.tag(1, WireType.LengthDelimited).string(message.email);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.UpdateUserInfoRequest
 */
export const UpdateUserInfoRequest = new UpdateUserInfoRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class UserPasswordChangeTicket$Type extends MessageType<UserPasswordChangeTicket> {
    constructor() {
        super("gooseai.UserPasswordChangeTicket", [
            { no: 1, name: "ticket", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value?: PartialMessage<UserPasswordChangeTicket>): UserPasswordChangeTicket {
        const message = { ticket: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<UserPasswordChangeTicket>(this, message, value);
        return message;
    }
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UserPasswordChangeTicket): UserPasswordChangeTicket {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string ticket */ 1:
                    message.ticket = 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: UserPasswordChangeTicket, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string ticket = 1; */
        if (message.ticket !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.ticket);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message gooseai.UserPasswordChangeTicket
 */
export const UserPasswordChangeTicket = new UserPasswordChangeTicket$Type();
/**
 * @generated ServiceType for protobuf service gooseai.DashboardService
 */
export const DashboardService = new ServiceType("gooseai.DashboardService", [
    { name: "GetMe", options: {}, I: EmptyRequest, O: User },
    { name: "GetOrganization", options: {}, I: GetOrganizationRequest, O: Organization },
    { name: "GetMetrics", options: {}, I: GetMetricsRequest, O: Metrics },
    { name: "CreateAPIKey", options: {}, I: APIKeyRequest, O: APIKey },
    { name: "DeleteAPIKey", options: {}, I: APIKeyFindRequest, O: APIKey },
    { name: "UpdateDefaultOrganization", options: {}, I: UpdateDefaultOrganizationRequest, O: User },
    { name: "GetClientSettings", options: {}, I: EmptyRequest, O: ClientSettings },
    { name: "SetClientSettings", options: {}, I: ClientSettings, O: ClientSettings },
    { name: "UpdateUserInfo", options: {}, I: UpdateUserInfoRequest, O: User },
    { name: "CreatePasswordChangeTicket", options: {}, I: EmptyRequest, O: UserPasswordChangeTicket },
    { name: "DeleteAccount", options: {}, I: EmptyRequest, O: User },
    { name: "CreateCharge", options: {}, I: CreateChargeRequest, O: Charge },
    { name: "GetCharges", options: {}, I: GetChargesRequest, O: Charges },
    { name: "CreateAutoChargeIntent", options: {}, I: CreateAutoChargeIntentRequest, O: AutoChargeIntent },
    { name: "UpdateAutoChargeIntent", options: {}, I: CreateAutoChargeIntentRequest, O: AutoChargeIntent },
    { name: "GetAutoChargeIntent", options: {}, I: GetAutoChargeRequest, O: AutoChargeIntent }
]);
