
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck 
/*
 * This file exports the `Apikey` model and its related types.
 *
 * 🟢 You can import this file directly.
 */
import type * as runtime from "@prisma/client/runtime/client"
import type * as $Enums from "../enums.js"
import type * as Prisma from "../internal/prismaNamespace.js"

/**
 * Model Apikey
 * 
 */
export type ApikeyModel = runtime.Types.Result.DefaultSelection<Prisma.$ApikeyPayload>

export type AggregateApikey = {
  _count: ApikeyCountAggregateOutputType | null
  _avg: ApikeyAvgAggregateOutputType | null
  _sum: ApikeySumAggregateOutputType | null
  _min: ApikeyMinAggregateOutputType | null
  _max: ApikeyMaxAggregateOutputType | null
}

export type ApikeyAvgAggregateOutputType = {
  refillInterval: number | null
  refillAmount: number | null
  rateLimitTimeWindow: number | null
  rateLimitMax: number | null
  requestCount: number | null
  remaining: number | null
}

export type ApikeySumAggregateOutputType = {
  refillInterval: number | null
  refillAmount: number | null
  rateLimitTimeWindow: number | null
  rateLimitMax: number | null
  requestCount: number | null
  remaining: number | null
}

export type ApikeyMinAggregateOutputType = {
  id: string | null
  configId: string | null
  name: string | null
  start: string | null
  referenceId: string | null
  prefix: string | null
  key: string | null
  refillInterval: number | null
  refillAmount: number | null
  lastRefillAt: Date | null
  enabled: boolean | null
  rateLimitEnabled: boolean | null
  rateLimitTimeWindow: number | null
  rateLimitMax: number | null
  requestCount: number | null
  remaining: number | null
  lastRequest: Date | null
  expiresAt: Date | null
  createdAt: Date | null
  updatedAt: Date | null
  permissions: string | null
  metadata: string | null
}

export type ApikeyMaxAggregateOutputType = {
  id: string | null
  configId: string | null
  name: string | null
  start: string | null
  referenceId: string | null
  prefix: string | null
  key: string | null
  refillInterval: number | null
  refillAmount: number | null
  lastRefillAt: Date | null
  enabled: boolean | null
  rateLimitEnabled: boolean | null
  rateLimitTimeWindow: number | null
  rateLimitMax: number | null
  requestCount: number | null
  remaining: number | null
  lastRequest: Date | null
  expiresAt: Date | null
  createdAt: Date | null
  updatedAt: Date | null
  permissions: string | null
  metadata: string | null
}

export type ApikeyCountAggregateOutputType = {
  id: number
  configId: number
  name: number
  start: number
  referenceId: number
  prefix: number
  key: number
  refillInterval: number
  refillAmount: number
  lastRefillAt: number
  enabled: number
  rateLimitEnabled: number
  rateLimitTimeWindow: number
  rateLimitMax: number
  requestCount: number
  remaining: number
  lastRequest: number
  expiresAt: number
  createdAt: number
  updatedAt: number
  permissions: number
  metadata: number
  _all: number
}


export type ApikeyAvgAggregateInputType = {
  refillInterval?: true
  refillAmount?: true
  rateLimitTimeWindow?: true
  rateLimitMax?: true
  requestCount?: true
  remaining?: true
}

export type ApikeySumAggregateInputType = {
  refillInterval?: true
  refillAmount?: true
  rateLimitTimeWindow?: true
  rateLimitMax?: true
  requestCount?: true
  remaining?: true
}

export type ApikeyMinAggregateInputType = {
  id?: true
  configId?: true
  name?: true
  start?: true
  referenceId?: true
  prefix?: true
  key?: true
  refillInterval?: true
  refillAmount?: true
  lastRefillAt?: true
  enabled?: true
  rateLimitEnabled?: true
  rateLimitTimeWindow?: true
  rateLimitMax?: true
  requestCount?: true
  remaining?: true
  lastRequest?: true
  expiresAt?: true
  createdAt?: true
  updatedAt?: true
  permissions?: true
  metadata?: true
}

export type ApikeyMaxAggregateInputType = {
  id?: true
  configId?: true
  name?: true
  start?: true
  referenceId?: true
  prefix?: true
  key?: true
  refillInterval?: true
  refillAmount?: true
  lastRefillAt?: true
  enabled?: true
  rateLimitEnabled?: true
  rateLimitTimeWindow?: true
  rateLimitMax?: true
  requestCount?: true
  remaining?: true
  lastRequest?: true
  expiresAt?: true
  createdAt?: true
  updatedAt?: true
  permissions?: true
  metadata?: true
}

export type ApikeyCountAggregateInputType = {
  id?: true
  configId?: true
  name?: true
  start?: true
  referenceId?: true
  prefix?: true
  key?: true
  refillInterval?: true
  refillAmount?: true
  lastRefillAt?: true
  enabled?: true
  rateLimitEnabled?: true
  rateLimitTimeWindow?: true
  rateLimitMax?: true
  requestCount?: true
  remaining?: true
  lastRequest?: true
  expiresAt?: true
  createdAt?: true
  updatedAt?: true
  permissions?: true
  metadata?: true
  _all?: true
}

export type ApikeyAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Filter which Apikey to aggregate.
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Apikeys to fetch.
   */
  orderBy?: Prisma.ApikeyOrderByWithRelationInput | Prisma.ApikeyOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the start position
   */
  cursor?: Prisma.ApikeyWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Apikeys from the position of the cursor.
   */
  take?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Skip the first `n` Apikeys.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Count returned Apikeys
  **/
  _count?: true | ApikeyCountAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to average
  **/
  _avg?: ApikeyAvgAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to sum
  **/
  _sum?: ApikeySumAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to find the minimum value
  **/
  _min?: ApikeyMinAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to find the maximum value
  **/
  _max?: ApikeyMaxAggregateInputType
}

export type GetApikeyAggregateType<T extends ApikeyAggregateArgs> = {
      [P in keyof T & keyof AggregateApikey]: P extends '_count' | 'count'
    ? T[P] extends true
      ? number
      : Prisma.GetScalarType<T[P], AggregateApikey[P]>
    : Prisma.GetScalarType<T[P], AggregateApikey[P]>
}




export type ApikeyGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  where?: Prisma.ApikeyWhereInput
  orderBy?: Prisma.ApikeyOrderByWithAggregationInput | Prisma.ApikeyOrderByWithAggregationInput[]
  by: Prisma.ApikeyScalarFieldEnum[] | Prisma.ApikeyScalarFieldEnum
  having?: Prisma.ApikeyScalarWhereWithAggregatesInput
  take?: number
  skip?: number
  _count?: ApikeyCountAggregateInputType | true
  _avg?: ApikeyAvgAggregateInputType
  _sum?: ApikeySumAggregateInputType
  _min?: ApikeyMinAggregateInputType
  _max?: ApikeyMaxAggregateInputType
}

export type ApikeyGroupByOutputType = {
  id: string
  configId: string
  name: string | null
  start: string | null
  referenceId: string
  prefix: string | null
  key: string
  refillInterval: number | null
  refillAmount: number | null
  lastRefillAt: Date | null
  enabled: boolean | null
  rateLimitEnabled: boolean | null
  rateLimitTimeWindow: number | null
  rateLimitMax: number | null
  requestCount: number | null
  remaining: number | null
  lastRequest: Date | null
  expiresAt: Date | null
  createdAt: Date
  updatedAt: Date
  permissions: string | null
  metadata: string | null
  _count: ApikeyCountAggregateOutputType | null
  _avg: ApikeyAvgAggregateOutputType | null
  _sum: ApikeySumAggregateOutputType | null
  _min: ApikeyMinAggregateOutputType | null
  _max: ApikeyMaxAggregateOutputType | null
}

export type GetApikeyGroupByPayload<T extends ApikeyGroupByArgs> = Prisma.PrismaPromise<
  Array<
    Prisma.PickEnumerable<ApikeyGroupByOutputType, T['by']> &
      {
        [P in ((keyof T) & (keyof ApikeyGroupByOutputType))]: P extends '_count'
          ? T[P] extends boolean
            ? number
            : Prisma.GetScalarType<T[P], ApikeyGroupByOutputType[P]>
          : Prisma.GetScalarType<T[P], ApikeyGroupByOutputType[P]>
      }
    >
  >



export type ApikeyWhereInput = {
  AND?: Prisma.ApikeyWhereInput | Prisma.ApikeyWhereInput[]
  OR?: Prisma.ApikeyWhereInput[]
  NOT?: Prisma.ApikeyWhereInput | Prisma.ApikeyWhereInput[]
  id?: Prisma.StringFilter<"Apikey"> | string
  configId?: Prisma.StringFilter<"Apikey"> | string
  name?: Prisma.StringNullableFilter<"Apikey"> | string | null
  start?: Prisma.StringNullableFilter<"Apikey"> | string | null
  referenceId?: Prisma.StringFilter<"Apikey"> | string
  prefix?: Prisma.StringNullableFilter<"Apikey"> | string | null
  key?: Prisma.StringFilter<"Apikey"> | string
  refillInterval?: Prisma.IntNullableFilter<"Apikey"> | number | null
  refillAmount?: Prisma.IntNullableFilter<"Apikey"> | number | null
  lastRefillAt?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  enabled?: Prisma.BoolNullableFilter<"Apikey"> | boolean | null
  rateLimitEnabled?: Prisma.BoolNullableFilter<"Apikey"> | boolean | null
  rateLimitTimeWindow?: Prisma.IntNullableFilter<"Apikey"> | number | null
  rateLimitMax?: Prisma.IntNullableFilter<"Apikey"> | number | null
  requestCount?: Prisma.IntNullableFilter<"Apikey"> | number | null
  remaining?: Prisma.IntNullableFilter<"Apikey"> | number | null
  lastRequest?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  expiresAt?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  createdAt?: Prisma.DateTimeFilter<"Apikey"> | Date | string
  updatedAt?: Prisma.DateTimeFilter<"Apikey"> | Date | string
  permissions?: Prisma.StringNullableFilter<"Apikey"> | string | null
  metadata?: Prisma.StringNullableFilter<"Apikey"> | string | null
}

export type ApikeyOrderByWithRelationInput = {
  id?: Prisma.SortOrder
  configId?: Prisma.SortOrder
  name?: Prisma.SortOrderInput | Prisma.SortOrder
  start?: Prisma.SortOrderInput | Prisma.SortOrder
  referenceId?: Prisma.SortOrder
  prefix?: Prisma.SortOrderInput | Prisma.SortOrder
  key?: Prisma.SortOrder
  refillInterval?: Prisma.SortOrderInput | Prisma.SortOrder
  refillAmount?: Prisma.SortOrderInput | Prisma.SortOrder
  lastRefillAt?: Prisma.SortOrderInput | Prisma.SortOrder
  enabled?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitEnabled?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrderInput | Prisma.SortOrder
  requestCount?: Prisma.SortOrderInput | Prisma.SortOrder
  remaining?: Prisma.SortOrderInput | Prisma.SortOrder
  lastRequest?: Prisma.SortOrderInput | Prisma.SortOrder
  expiresAt?: Prisma.SortOrderInput | Prisma.SortOrder
  createdAt?: Prisma.SortOrder
  updatedAt?: Prisma.SortOrder
  permissions?: Prisma.SortOrderInput | Prisma.SortOrder
  metadata?: Prisma.SortOrderInput | Prisma.SortOrder
}

export type ApikeyWhereUniqueInput = Prisma.AtLeast<{
  id?: string
  AND?: Prisma.ApikeyWhereInput | Prisma.ApikeyWhereInput[]
  OR?: Prisma.ApikeyWhereInput[]
  NOT?: Prisma.ApikeyWhereInput | Prisma.ApikeyWhereInput[]
  configId?: Prisma.StringFilter<"Apikey"> | string
  name?: Prisma.StringNullableFilter<"Apikey"> | string | null
  start?: Prisma.StringNullableFilter<"Apikey"> | string | null
  referenceId?: Prisma.StringFilter<"Apikey"> | string
  prefix?: Prisma.StringNullableFilter<"Apikey"> | string | null
  key?: Prisma.StringFilter<"Apikey"> | string
  refillInterval?: Prisma.IntNullableFilter<"Apikey"> | number | null
  refillAmount?: Prisma.IntNullableFilter<"Apikey"> | number | null
  lastRefillAt?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  enabled?: Prisma.BoolNullableFilter<"Apikey"> | boolean | null
  rateLimitEnabled?: Prisma.BoolNullableFilter<"Apikey"> | boolean | null
  rateLimitTimeWindow?: Prisma.IntNullableFilter<"Apikey"> | number | null
  rateLimitMax?: Prisma.IntNullableFilter<"Apikey"> | number | null
  requestCount?: Prisma.IntNullableFilter<"Apikey"> | number | null
  remaining?: Prisma.IntNullableFilter<"Apikey"> | number | null
  lastRequest?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  expiresAt?: Prisma.DateTimeNullableFilter<"Apikey"> | Date | string | null
  createdAt?: Prisma.DateTimeFilter<"Apikey"> | Date | string
  updatedAt?: Prisma.DateTimeFilter<"Apikey"> | Date | string
  permissions?: Prisma.StringNullableFilter<"Apikey"> | string | null
  metadata?: Prisma.StringNullableFilter<"Apikey"> | string | null
}, "id">

export type ApikeyOrderByWithAggregationInput = {
  id?: Prisma.SortOrder
  configId?: Prisma.SortOrder
  name?: Prisma.SortOrderInput | Prisma.SortOrder
  start?: Prisma.SortOrderInput | Prisma.SortOrder
  referenceId?: Prisma.SortOrder
  prefix?: Prisma.SortOrderInput | Prisma.SortOrder
  key?: Prisma.SortOrder
  refillInterval?: Prisma.SortOrderInput | Prisma.SortOrder
  refillAmount?: Prisma.SortOrderInput | Prisma.SortOrder
  lastRefillAt?: Prisma.SortOrderInput | Prisma.SortOrder
  enabled?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitEnabled?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrderInput | Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrderInput | Prisma.SortOrder
  requestCount?: Prisma.SortOrderInput | Prisma.SortOrder
  remaining?: Prisma.SortOrderInput | Prisma.SortOrder
  lastRequest?: Prisma.SortOrderInput | Prisma.SortOrder
  expiresAt?: Prisma.SortOrderInput | Prisma.SortOrder
  createdAt?: Prisma.SortOrder
  updatedAt?: Prisma.SortOrder
  permissions?: Prisma.SortOrderInput | Prisma.SortOrder
  metadata?: Prisma.SortOrderInput | Prisma.SortOrder
  _count?: Prisma.ApikeyCountOrderByAggregateInput
  _avg?: Prisma.ApikeyAvgOrderByAggregateInput
  _max?: Prisma.ApikeyMaxOrderByAggregateInput
  _min?: Prisma.ApikeyMinOrderByAggregateInput
  _sum?: Prisma.ApikeySumOrderByAggregateInput
}

export type ApikeyScalarWhereWithAggregatesInput = {
  AND?: Prisma.ApikeyScalarWhereWithAggregatesInput | Prisma.ApikeyScalarWhereWithAggregatesInput[]
  OR?: Prisma.ApikeyScalarWhereWithAggregatesInput[]
  NOT?: Prisma.ApikeyScalarWhereWithAggregatesInput | Prisma.ApikeyScalarWhereWithAggregatesInput[]
  id?: Prisma.StringWithAggregatesFilter<"Apikey"> | string
  configId?: Prisma.StringWithAggregatesFilter<"Apikey"> | string
  name?: Prisma.StringNullableWithAggregatesFilter<"Apikey"> | string | null
  start?: Prisma.StringNullableWithAggregatesFilter<"Apikey"> | string | null
  referenceId?: Prisma.StringWithAggregatesFilter<"Apikey"> | string
  prefix?: Prisma.StringNullableWithAggregatesFilter<"Apikey"> | string | null
  key?: Prisma.StringWithAggregatesFilter<"Apikey"> | string
  refillInterval?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  refillAmount?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  lastRefillAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Apikey"> | Date | string | null
  enabled?: Prisma.BoolNullableWithAggregatesFilter<"Apikey"> | boolean | null
  rateLimitEnabled?: Prisma.BoolNullableWithAggregatesFilter<"Apikey"> | boolean | null
  rateLimitTimeWindow?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  rateLimitMax?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  requestCount?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  remaining?: Prisma.IntNullableWithAggregatesFilter<"Apikey"> | number | null
  lastRequest?: Prisma.DateTimeNullableWithAggregatesFilter<"Apikey"> | Date | string | null
  expiresAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Apikey"> | Date | string | null
  createdAt?: Prisma.DateTimeWithAggregatesFilter<"Apikey"> | Date | string
  updatedAt?: Prisma.DateTimeWithAggregatesFilter<"Apikey"> | Date | string
  permissions?: Prisma.StringNullableWithAggregatesFilter<"Apikey"> | string | null
  metadata?: Prisma.StringNullableWithAggregatesFilter<"Apikey"> | string | null
}

export type ApikeyCreateInput = {
  id: string
  configId?: string
  name?: string | null
  start?: string | null
  referenceId: string
  prefix?: string | null
  key: string
  refillInterval?: number | null
  refillAmount?: number | null
  lastRefillAt?: Date | string | null
  enabled?: boolean | null
  rateLimitEnabled?: boolean | null
  rateLimitTimeWindow?: number | null
  rateLimitMax?: number | null
  requestCount?: number | null
  remaining?: number | null
  lastRequest?: Date | string | null
  expiresAt?: Date | string | null
  createdAt: Date | string
  updatedAt: Date | string
  permissions?: string | null
  metadata?: string | null
}

export type ApikeyUncheckedCreateInput = {
  id: string
  configId?: string
  name?: string | null
  start?: string | null
  referenceId: string
  prefix?: string | null
  key: string
  refillInterval?: number | null
  refillAmount?: number | null
  lastRefillAt?: Date | string | null
  enabled?: boolean | null
  rateLimitEnabled?: boolean | null
  rateLimitTimeWindow?: number | null
  rateLimitMax?: number | null
  requestCount?: number | null
  remaining?: number | null
  lastRequest?: Date | string | null
  expiresAt?: Date | string | null
  createdAt: Date | string
  updatedAt: Date | string
  permissions?: string | null
  metadata?: string | null
}

export type ApikeyUpdateInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  configId?: Prisma.StringFieldUpdateOperationsInput | string
  name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  start?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  referenceId?: Prisma.StringFieldUpdateOperationsInput | string
  prefix?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  key?: Prisma.StringFieldUpdateOperationsInput | string
  refillInterval?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  refillAmount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRefillAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  enabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitEnabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitTimeWindow?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  rateLimitMax?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  requestCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  remaining?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRequest?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  expiresAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  permissions?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  metadata?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type ApikeyUncheckedUpdateInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  configId?: Prisma.StringFieldUpdateOperationsInput | string
  name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  start?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  referenceId?: Prisma.StringFieldUpdateOperationsInput | string
  prefix?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  key?: Prisma.StringFieldUpdateOperationsInput | string
  refillInterval?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  refillAmount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRefillAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  enabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitEnabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitTimeWindow?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  rateLimitMax?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  requestCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  remaining?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRequest?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  expiresAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  permissions?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  metadata?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type ApikeyCreateManyInput = {
  id: string
  configId?: string
  name?: string | null
  start?: string | null
  referenceId: string
  prefix?: string | null
  key: string
  refillInterval?: number | null
  refillAmount?: number | null
  lastRefillAt?: Date | string | null
  enabled?: boolean | null
  rateLimitEnabled?: boolean | null
  rateLimitTimeWindow?: number | null
  rateLimitMax?: number | null
  requestCount?: number | null
  remaining?: number | null
  lastRequest?: Date | string | null
  expiresAt?: Date | string | null
  createdAt: Date | string
  updatedAt: Date | string
  permissions?: string | null
  metadata?: string | null
}

export type ApikeyUpdateManyMutationInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  configId?: Prisma.StringFieldUpdateOperationsInput | string
  name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  start?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  referenceId?: Prisma.StringFieldUpdateOperationsInput | string
  prefix?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  key?: Prisma.StringFieldUpdateOperationsInput | string
  refillInterval?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  refillAmount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRefillAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  enabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitEnabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitTimeWindow?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  rateLimitMax?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  requestCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  remaining?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRequest?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  expiresAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  permissions?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  metadata?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type ApikeyUncheckedUpdateManyInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  configId?: Prisma.StringFieldUpdateOperationsInput | string
  name?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  start?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  referenceId?: Prisma.StringFieldUpdateOperationsInput | string
  prefix?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  key?: Prisma.StringFieldUpdateOperationsInput | string
  refillInterval?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  refillAmount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRefillAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  enabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitEnabled?: Prisma.NullableBoolFieldUpdateOperationsInput | boolean | null
  rateLimitTimeWindow?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  rateLimitMax?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  requestCount?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  remaining?: Prisma.NullableIntFieldUpdateOperationsInput | number | null
  lastRequest?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  expiresAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  permissions?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  metadata?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type ApikeyCountOrderByAggregateInput = {
  id?: Prisma.SortOrder
  configId?: Prisma.SortOrder
  name?: Prisma.SortOrder
  start?: Prisma.SortOrder
  referenceId?: Prisma.SortOrder
  prefix?: Prisma.SortOrder
  key?: Prisma.SortOrder
  refillInterval?: Prisma.SortOrder
  refillAmount?: Prisma.SortOrder
  lastRefillAt?: Prisma.SortOrder
  enabled?: Prisma.SortOrder
  rateLimitEnabled?: Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrder
  requestCount?: Prisma.SortOrder
  remaining?: Prisma.SortOrder
  lastRequest?: Prisma.SortOrder
  expiresAt?: Prisma.SortOrder
  createdAt?: Prisma.SortOrder
  updatedAt?: Prisma.SortOrder
  permissions?: Prisma.SortOrder
  metadata?: Prisma.SortOrder
}

export type ApikeyAvgOrderByAggregateInput = {
  refillInterval?: Prisma.SortOrder
  refillAmount?: Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrder
  requestCount?: Prisma.SortOrder
  remaining?: Prisma.SortOrder
}

export type ApikeyMaxOrderByAggregateInput = {
  id?: Prisma.SortOrder
  configId?: Prisma.SortOrder
  name?: Prisma.SortOrder
  start?: Prisma.SortOrder
  referenceId?: Prisma.SortOrder
  prefix?: Prisma.SortOrder
  key?: Prisma.SortOrder
  refillInterval?: Prisma.SortOrder
  refillAmount?: Prisma.SortOrder
  lastRefillAt?: Prisma.SortOrder
  enabled?: Prisma.SortOrder
  rateLimitEnabled?: Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrder
  requestCount?: Prisma.SortOrder
  remaining?: Prisma.SortOrder
  lastRequest?: Prisma.SortOrder
  expiresAt?: Prisma.SortOrder
  createdAt?: Prisma.SortOrder
  updatedAt?: Prisma.SortOrder
  permissions?: Prisma.SortOrder
  metadata?: Prisma.SortOrder
}

export type ApikeyMinOrderByAggregateInput = {
  id?: Prisma.SortOrder
  configId?: Prisma.SortOrder
  name?: Prisma.SortOrder
  start?: Prisma.SortOrder
  referenceId?: Prisma.SortOrder
  prefix?: Prisma.SortOrder
  key?: Prisma.SortOrder
  refillInterval?: Prisma.SortOrder
  refillAmount?: Prisma.SortOrder
  lastRefillAt?: Prisma.SortOrder
  enabled?: Prisma.SortOrder
  rateLimitEnabled?: Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrder
  requestCount?: Prisma.SortOrder
  remaining?: Prisma.SortOrder
  lastRequest?: Prisma.SortOrder
  expiresAt?: Prisma.SortOrder
  createdAt?: Prisma.SortOrder
  updatedAt?: Prisma.SortOrder
  permissions?: Prisma.SortOrder
  metadata?: Prisma.SortOrder
}

export type ApikeySumOrderByAggregateInput = {
  refillInterval?: Prisma.SortOrder
  refillAmount?: Prisma.SortOrder
  rateLimitTimeWindow?: Prisma.SortOrder
  rateLimitMax?: Prisma.SortOrder
  requestCount?: Prisma.SortOrder
  remaining?: Prisma.SortOrder
}

export type NullableIntFieldUpdateOperationsInput = {
  set?: number | null
  increment?: number
  decrement?: number
  multiply?: number
  divide?: number
}



export type ApikeySelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  configId?: boolean
  name?: boolean
  start?: boolean
  referenceId?: boolean
  prefix?: boolean
  key?: boolean
  refillInterval?: boolean
  refillAmount?: boolean
  lastRefillAt?: boolean
  enabled?: boolean
  rateLimitEnabled?: boolean
  rateLimitTimeWindow?: boolean
  rateLimitMax?: boolean
  requestCount?: boolean
  remaining?: boolean
  lastRequest?: boolean
  expiresAt?: boolean
  createdAt?: boolean
  updatedAt?: boolean
  permissions?: boolean
  metadata?: boolean
}, ExtArgs["result"]["apikey"]>

export type ApikeySelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  configId?: boolean
  name?: boolean
  start?: boolean
  referenceId?: boolean
  prefix?: boolean
  key?: boolean
  refillInterval?: boolean
  refillAmount?: boolean
  lastRefillAt?: boolean
  enabled?: boolean
  rateLimitEnabled?: boolean
  rateLimitTimeWindow?: boolean
  rateLimitMax?: boolean
  requestCount?: boolean
  remaining?: boolean
  lastRequest?: boolean
  expiresAt?: boolean
  createdAt?: boolean
  updatedAt?: boolean
  permissions?: boolean
  metadata?: boolean
}, ExtArgs["result"]["apikey"]>

export type ApikeySelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  configId?: boolean
  name?: boolean
  start?: boolean
  referenceId?: boolean
  prefix?: boolean
  key?: boolean
  refillInterval?: boolean
  refillAmount?: boolean
  lastRefillAt?: boolean
  enabled?: boolean
  rateLimitEnabled?: boolean
  rateLimitTimeWindow?: boolean
  rateLimitMax?: boolean
  requestCount?: boolean
  remaining?: boolean
  lastRequest?: boolean
  expiresAt?: boolean
  createdAt?: boolean
  updatedAt?: boolean
  permissions?: boolean
  metadata?: boolean
}, ExtArgs["result"]["apikey"]>

export type ApikeySelectScalar = {
  id?: boolean
  configId?: boolean
  name?: boolean
  start?: boolean
  referenceId?: boolean
  prefix?: boolean
  key?: boolean
  refillInterval?: boolean
  refillAmount?: boolean
  lastRefillAt?: boolean
  enabled?: boolean
  rateLimitEnabled?: boolean
  rateLimitTimeWindow?: boolean
  rateLimitMax?: boolean
  requestCount?: boolean
  remaining?: boolean
  lastRequest?: boolean
  expiresAt?: boolean
  createdAt?: boolean
  updatedAt?: boolean
  permissions?: boolean
  metadata?: boolean
}

export type ApikeyOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "configId" | "name" | "start" | "referenceId" | "prefix" | "key" | "refillInterval" | "refillAmount" | "lastRefillAt" | "enabled" | "rateLimitEnabled" | "rateLimitTimeWindow" | "rateLimitMax" | "requestCount" | "remaining" | "lastRequest" | "expiresAt" | "createdAt" | "updatedAt" | "permissions" | "metadata", ExtArgs["result"]["apikey"]>

export type $ApikeyPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  name: "Apikey"
  objects: {}
  scalars: runtime.Types.Extensions.GetPayloadResult<{
    id: string
    configId: string
    name: string | null
    start: string | null
    referenceId: string
    prefix: string | null
    key: string
    refillInterval: number | null
    refillAmount: number | null
    lastRefillAt: Date | null
    enabled: boolean | null
    rateLimitEnabled: boolean | null
    rateLimitTimeWindow: number | null
    rateLimitMax: number | null
    requestCount: number | null
    remaining: number | null
    lastRequest: Date | null
    expiresAt: Date | null
    createdAt: Date
    updatedAt: Date
    permissions: string | null
    metadata: string | null
  }, ExtArgs["result"]["apikey"]>
  composites: {}
}

export type ApikeyGetPayload<S extends boolean | null | undefined | ApikeyDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$ApikeyPayload, S>

export type ApikeyCountArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> =
  Omit<ApikeyFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {
    select?: ApikeyCountAggregateInputType | true
  }

export interface ApikeyDelegate<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> {
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['model']['Apikey'], meta: { name: 'Apikey' } }
  /**
   * Find zero or one Apikey that matches the filter.
   * @param {ApikeyFindUniqueArgs} args - Arguments to find a Apikey
   * @example
   * // Get one Apikey
   * const apikey = await prisma.apikey.findUnique({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findUnique<T extends ApikeyFindUniqueArgs>(args: Prisma.SelectSubset<T, ApikeyFindUniqueArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>

  /**
   * Find one Apikey that matches the filter or throw an error with `error.code='P2025'`
   * if no matches were found.
   * @param {ApikeyFindUniqueOrThrowArgs} args - Arguments to find a Apikey
   * @example
   * // Get one Apikey
   * const apikey = await prisma.apikey.findUniqueOrThrow({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findUniqueOrThrow<T extends ApikeyFindUniqueOrThrowArgs>(args: Prisma.SelectSubset<T, ApikeyFindUniqueOrThrowArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Find the first Apikey that matches the filter.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyFindFirstArgs} args - Arguments to find a Apikey
   * @example
   * // Get one Apikey
   * const apikey = await prisma.apikey.findFirst({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findFirst<T extends ApikeyFindFirstArgs>(args?: Prisma.SelectSubset<T, ApikeyFindFirstArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>

  /**
   * Find the first Apikey that matches the filter or
   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyFindFirstOrThrowArgs} args - Arguments to find a Apikey
   * @example
   * // Get one Apikey
   * const apikey = await prisma.apikey.findFirstOrThrow({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findFirstOrThrow<T extends ApikeyFindFirstOrThrowArgs>(args?: Prisma.SelectSubset<T, ApikeyFindFirstOrThrowArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Find zero or more Apikeys that matches the filter.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyFindManyArgs} args - Arguments to filter and select certain fields only.
   * @example
   * // Get all Apikeys
   * const apikeys = await prisma.apikey.findMany()
   * 
   * // Get first 10 Apikeys
   * const apikeys = await prisma.apikey.findMany({ take: 10 })
   * 
   * // Only select the `id`
   * const apikeyWithIdOnly = await prisma.apikey.findMany({ select: { id: true } })
   * 
   */
  findMany<T extends ApikeyFindManyArgs>(args?: Prisma.SelectSubset<T, ApikeyFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>

  /**
   * Create a Apikey.
   * @param {ApikeyCreateArgs} args - Arguments to create a Apikey.
   * @example
   * // Create one Apikey
   * const Apikey = await prisma.apikey.create({
   *   data: {
   *     // ... data to create a Apikey
   *   }
   * })
   * 
   */
  create<T extends ApikeyCreateArgs>(args: Prisma.SelectSubset<T, ApikeyCreateArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Create many Apikeys.
   * @param {ApikeyCreateManyArgs} args - Arguments to create many Apikeys.
   * @example
   * // Create many Apikeys
   * const apikey = await prisma.apikey.createMany({
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   *     
   */
  createMany<T extends ApikeyCreateManyArgs>(args?: Prisma.SelectSubset<T, ApikeyCreateManyArgs<ExtArgs>>): Prisma.PrismaPromise<Prisma.BatchPayload>

  /**
   * Create many Apikeys and returns the data saved in the database.
   * @param {ApikeyCreateManyAndReturnArgs} args - Arguments to create many Apikeys.
   * @example
   * // Create many Apikeys
   * const apikey = await prisma.apikey.createManyAndReturn({
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * 
   * // Create many Apikeys and only return the `id`
   * const apikeyWithIdOnly = await prisma.apikey.createManyAndReturn({
   *   select: { id: true },
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * 
   */
  createManyAndReturn<T extends ApikeyCreateManyAndReturnArgs>(args?: Prisma.SelectSubset<T, ApikeyCreateManyAndReturnArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "createManyAndReturn", GlobalOmitOptions>>

  /**
   * Delete a Apikey.
   * @param {ApikeyDeleteArgs} args - Arguments to delete one Apikey.
   * @example
   * // Delete one Apikey
   * const Apikey = await prisma.apikey.delete({
   *   where: {
   *     // ... filter to delete one Apikey
   *   }
   * })
   * 
   */
  delete<T extends ApikeyDeleteArgs>(args: Prisma.SelectSubset<T, ApikeyDeleteArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Update one Apikey.
   * @param {ApikeyUpdateArgs} args - Arguments to update one Apikey.
   * @example
   * // Update one Apikey
   * const apikey = await prisma.apikey.update({
   *   where: {
   *     // ... provide filter here
   *   },
   *   data: {
   *     // ... provide data here
   *   }
   * })
   * 
   */
  update<T extends ApikeyUpdateArgs>(args: Prisma.SelectSubset<T, ApikeyUpdateArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Delete zero or more Apikeys.
   * @param {ApikeyDeleteManyArgs} args - Arguments to filter Apikeys to delete.
   * @example
   * // Delete a few Apikeys
   * const { count } = await prisma.apikey.deleteMany({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   * 
   */
  deleteMany<T extends ApikeyDeleteManyArgs>(args?: Prisma.SelectSubset<T, ApikeyDeleteManyArgs<ExtArgs>>): Prisma.PrismaPromise<Prisma.BatchPayload>

  /**
   * Update zero or more Apikeys.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyUpdateManyArgs} args - Arguments to update one or more rows.
   * @example
   * // Update many Apikeys
   * const apikey = await prisma.apikey.updateMany({
   *   where: {
   *     // ... provide filter here
   *   },
   *   data: {
   *     // ... provide data here
   *   }
   * })
   * 
   */
  updateMany<T extends ApikeyUpdateManyArgs>(args: Prisma.SelectSubset<T, ApikeyUpdateManyArgs<ExtArgs>>): Prisma.PrismaPromise<Prisma.BatchPayload>

  /**
   * Update zero or more Apikeys and returns the data updated in the database.
   * @param {ApikeyUpdateManyAndReturnArgs} args - Arguments to update many Apikeys.
   * @example
   * // Update many Apikeys
   * const apikey = await prisma.apikey.updateManyAndReturn({
   *   where: {
   *     // ... provide filter here
   *   },
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * 
   * // Update zero or more Apikeys and only return the `id`
   * const apikeyWithIdOnly = await prisma.apikey.updateManyAndReturn({
   *   select: { id: true },
   *   where: {
   *     // ... provide filter here
   *   },
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * 
   */
  updateManyAndReturn<T extends ApikeyUpdateManyAndReturnArgs>(args: Prisma.SelectSubset<T, ApikeyUpdateManyAndReturnArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "updateManyAndReturn", GlobalOmitOptions>>

  /**
   * Create or update one Apikey.
   * @param {ApikeyUpsertArgs} args - Arguments to update or create a Apikey.
   * @example
   * // Update or create a Apikey
   * const apikey = await prisma.apikey.upsert({
   *   create: {
   *     // ... data to create a Apikey
   *   },
   *   update: {
   *     // ... in case it already exists, update
   *   },
   *   where: {
   *     // ... the filter for the Apikey we want to update
   *   }
   * })
   */
  upsert<T extends ApikeyUpsertArgs>(args: Prisma.SelectSubset<T, ApikeyUpsertArgs<ExtArgs>>): Prisma.Prisma__ApikeyClient<runtime.Types.Result.GetResult<Prisma.$ApikeyPayload<ExtArgs>, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>


  /**
   * Count the number of Apikeys.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyCountArgs} args - Arguments to filter Apikeys to count.
   * @example
   * // Count the number of Apikeys
   * const count = await prisma.apikey.count({
   *   where: {
   *     // ... the filter for the Apikeys we want to count
   *   }
   * })
  **/
  count<T extends ApikeyCountArgs>(
    args?: Prisma.Subset<T, ApikeyCountArgs>,
  ): Prisma.PrismaPromise<
    T extends runtime.Types.Utils.Record<'select', any>
      ? T['select'] extends true
        ? number
        : Prisma.GetScalarType<T['select'], ApikeyCountAggregateOutputType>
      : number
  >

  /**
   * Allows you to perform aggregations operations on a Apikey.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyAggregateArgs} args - Select which aggregations you would like to apply and on what fields.
   * @example
   * // Ordered by age ascending
   * // Where email contains prisma.io
   * // Limited to the 10 users
   * const aggregations = await prisma.user.aggregate({
   *   _avg: {
   *     age: true,
   *   },
   *   where: {
   *     email: {
   *       contains: "prisma.io",
   *     },
   *   },
   *   orderBy: {
   *     age: "asc",
   *   },
   *   take: 10,
   * })
  **/
  aggregate<T extends ApikeyAggregateArgs>(args: Prisma.Subset<T, ApikeyAggregateArgs>): Prisma.PrismaPromise<GetApikeyAggregateType<T>>

  /**
   * Group by Apikey.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {ApikeyGroupByArgs} args - Group by arguments.
   * @example
   * // Group by city, order by createdAt, get count
   * const result = await prisma.user.groupBy({
   *   by: ['city', 'createdAt'],
   *   orderBy: {
   *     createdAt: true
   *   },
   *   _count: {
   *     _all: true
   *   },
   * })
   * 
  **/
  groupBy<
    T extends ApikeyGroupByArgs,
    HasSelectOrTake extends Prisma.Or<
      Prisma.Extends<'skip', Prisma.Keys<T>>,
      Prisma.Extends<'take', Prisma.Keys<T>>
    >,
    OrderByArg extends Prisma.True extends HasSelectOrTake
      ? { orderBy: ApikeyGroupByArgs['orderBy'] }
      : { orderBy?: ApikeyGroupByArgs['orderBy'] },
    OrderFields extends Prisma.ExcludeUnderscoreKeys<Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>>,
    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,
    ByValid extends Prisma.Has<ByFields, OrderFields>,
    HavingFields extends Prisma.GetHavingFields<T['having']>,
    HavingValid extends Prisma.Has<ByFields, HavingFields>,
    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,
    InputErrors extends ByEmpty extends Prisma.True
    ? `Error: "by" must not be empty.`
    : HavingValid extends Prisma.False
    ? {
        [P in HavingFields]: P extends ByFields
          ? never
          : P extends string
          ? `Error: Field "${P}" used in "having" needs to be provided in "by".`
          : [
              Error,
              'Field ',
              P,
              ` in "having" needs to be provided in "by"`,
            ]
      }[HavingFields]
    : 'take' extends Prisma.Keys<T>
    ? 'orderBy' extends Prisma.Keys<T>
      ? ByValid extends Prisma.True
        ? {}
        : {
            [P in OrderFields]: P extends ByFields
              ? never
              : `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
          }[OrderFields]
      : 'Error: If you provide "take", you also need to provide "orderBy"'
    : 'skip' extends Prisma.Keys<T>
    ? 'orderBy' extends Prisma.Keys<T>
      ? ByValid extends Prisma.True
        ? {}
        : {
            [P in OrderFields]: P extends ByFields
              ? never
              : `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
          }[OrderFields]
      : 'Error: If you provide "skip", you also need to provide "orderBy"'
    : ByValid extends Prisma.True
    ? {}
    : {
        [P in OrderFields]: P extends ByFields
          ? never
          : `Error: Field "${P}" in "orderBy" needs to be provided in "by"`
      }[OrderFields]
  >(args: Prisma.SubsetIntersection<T, ApikeyGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetApikeyGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
 * Fields of the Apikey model
 */
readonly fields: ApikeyFieldRefs;
}

/**
 * The delegate class that acts as a "Promise-like" for Apikey.
 * Why is this prefixed with `Prisma__`?
 * Because we want to prevent naming conflicts as mentioned in
 * https://github.com/prisma/prisma-client-js/issues/707
 */
export interface Prisma__ApikeyClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
  readonly [Symbol.toStringTag]: "PrismaPromise"
  /**
   * Attaches callbacks for the resolution and/or rejection of the Promise.
   * @param onfulfilled The callback to execute when the Promise is resolved.
   * @param onrejected The callback to execute when the Promise is rejected.
   * @returns A Promise for the completion of which ever callback is executed.
   */
  then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): runtime.Types.Utils.JsPromise<TResult1 | TResult2>
  /**
   * Attaches a callback for only the rejection of the Promise.
   * @param onrejected The callback to execute when the Promise is rejected.
   * @returns A Promise for the completion of the callback.
   */
  catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): runtime.Types.Utils.JsPromise<T | TResult>
  /**
   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
   * resolved value cannot be modified from the callback.
   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).
   * @returns A Promise for the completion of the callback.
   */
  finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise<T>
}




/**
 * Fields of the Apikey model
 */
export interface ApikeyFieldRefs {
  readonly id: Prisma.FieldRef<"Apikey", 'String'>
  readonly configId: Prisma.FieldRef<"Apikey", 'String'>
  readonly name: Prisma.FieldRef<"Apikey", 'String'>
  readonly start: Prisma.FieldRef<"Apikey", 'String'>
  readonly referenceId: Prisma.FieldRef<"Apikey", 'String'>
  readonly prefix: Prisma.FieldRef<"Apikey", 'String'>
  readonly key: Prisma.FieldRef<"Apikey", 'String'>
  readonly refillInterval: Prisma.FieldRef<"Apikey", 'Int'>
  readonly refillAmount: Prisma.FieldRef<"Apikey", 'Int'>
  readonly lastRefillAt: Prisma.FieldRef<"Apikey", 'DateTime'>
  readonly enabled: Prisma.FieldRef<"Apikey", 'Boolean'>
  readonly rateLimitEnabled: Prisma.FieldRef<"Apikey", 'Boolean'>
  readonly rateLimitTimeWindow: Prisma.FieldRef<"Apikey", 'Int'>
  readonly rateLimitMax: Prisma.FieldRef<"Apikey", 'Int'>
  readonly requestCount: Prisma.FieldRef<"Apikey", 'Int'>
  readonly remaining: Prisma.FieldRef<"Apikey", 'Int'>
  readonly lastRequest: Prisma.FieldRef<"Apikey", 'DateTime'>
  readonly expiresAt: Prisma.FieldRef<"Apikey", 'DateTime'>
  readonly createdAt: Prisma.FieldRef<"Apikey", 'DateTime'>
  readonly updatedAt: Prisma.FieldRef<"Apikey", 'DateTime'>
  readonly permissions: Prisma.FieldRef<"Apikey", 'String'>
  readonly metadata: Prisma.FieldRef<"Apikey", 'String'>
}
    

// Custom InputTypes
/**
 * Apikey findUnique
 */
export type ApikeyFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter, which Apikey to fetch.
   */
  where: Prisma.ApikeyWhereUniqueInput
}

/**
 * Apikey findUniqueOrThrow
 */
export type ApikeyFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter, which Apikey to fetch.
   */
  where: Prisma.ApikeyWhereUniqueInput
}

/**
 * Apikey findFirst
 */
export type ApikeyFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter, which Apikey to fetch.
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Apikeys to fetch.
   */
  orderBy?: Prisma.ApikeyOrderByWithRelationInput | Prisma.ApikeyOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for searching for Apikeys.
   */
  cursor?: Prisma.ApikeyWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Apikeys from the position of the cursor.
   */
  take?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Skip the first `n` Apikeys.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Apikeys.
   */
  distinct?: Prisma.ApikeyScalarFieldEnum | Prisma.ApikeyScalarFieldEnum[]
}

/**
 * Apikey findFirstOrThrow
 */
export type ApikeyFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter, which Apikey to fetch.
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Apikeys to fetch.
   */
  orderBy?: Prisma.ApikeyOrderByWithRelationInput | Prisma.ApikeyOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for searching for Apikeys.
   */
  cursor?: Prisma.ApikeyWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Apikeys from the position of the cursor.
   */
  take?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Skip the first `n` Apikeys.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Apikeys.
   */
  distinct?: Prisma.ApikeyScalarFieldEnum | Prisma.ApikeyScalarFieldEnum[]
}

/**
 * Apikey findMany
 */
export type ApikeyFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter, which Apikeys to fetch.
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Apikeys to fetch.
   */
  orderBy?: Prisma.ApikeyOrderByWithRelationInput | Prisma.ApikeyOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for listing Apikeys.
   */
  cursor?: Prisma.ApikeyWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Apikeys from the position of the cursor.
   */
  take?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Skip the first `n` Apikeys.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Apikeys.
   */
  distinct?: Prisma.ApikeyScalarFieldEnum | Prisma.ApikeyScalarFieldEnum[]
}

/**
 * Apikey create
 */
export type ApikeyCreateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * The data needed to create a Apikey.
   */
  data: Prisma.XOR<Prisma.ApikeyCreateInput, Prisma.ApikeyUncheckedCreateInput>
}

/**
 * Apikey createMany
 */
export type ApikeyCreateManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * The data used to create many Apikeys.
   */
  data: Prisma.ApikeyCreateManyInput | Prisma.ApikeyCreateManyInput[]
  skipDuplicates?: boolean
}

/**
 * Apikey createManyAndReturn
 */
export type ApikeyCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelectCreateManyAndReturn<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * The data used to create many Apikeys.
   */
  data: Prisma.ApikeyCreateManyInput | Prisma.ApikeyCreateManyInput[]
  skipDuplicates?: boolean
}

/**
 * Apikey update
 */
export type ApikeyUpdateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * The data needed to update a Apikey.
   */
  data: Prisma.XOR<Prisma.ApikeyUpdateInput, Prisma.ApikeyUncheckedUpdateInput>
  /**
   * Choose, which Apikey to update.
   */
  where: Prisma.ApikeyWhereUniqueInput
}

/**
 * Apikey updateMany
 */
export type ApikeyUpdateManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * The data used to update Apikeys.
   */
  data: Prisma.XOR<Prisma.ApikeyUpdateManyMutationInput, Prisma.ApikeyUncheckedUpdateManyInput>
  /**
   * Filter which Apikeys to update
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * Limit how many Apikeys to update.
   */
  limit?: number
}

/**
 * Apikey updateManyAndReturn
 */
export type ApikeyUpdateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelectUpdateManyAndReturn<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * The data used to update Apikeys.
   */
  data: Prisma.XOR<Prisma.ApikeyUpdateManyMutationInput, Prisma.ApikeyUncheckedUpdateManyInput>
  /**
   * Filter which Apikeys to update
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * Limit how many Apikeys to update.
   */
  limit?: number
}

/**
 * Apikey upsert
 */
export type ApikeyUpsertArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * The filter to search for the Apikey to update in case it exists.
   */
  where: Prisma.ApikeyWhereUniqueInput
  /**
   * In case the Apikey found by the `where` argument doesn't exist, create a new Apikey with this data.
   */
  create: Prisma.XOR<Prisma.ApikeyCreateInput, Prisma.ApikeyUncheckedCreateInput>
  /**
   * In case the Apikey was found with the provided `where` argument, update it with this data.
   */
  update: Prisma.XOR<Prisma.ApikeyUpdateInput, Prisma.ApikeyUncheckedUpdateInput>
}

/**
 * Apikey delete
 */
export type ApikeyDeleteArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
  /**
   * Filter which Apikey to delete.
   */
  where: Prisma.ApikeyWhereUniqueInput
}

/**
 * Apikey deleteMany
 */
export type ApikeyDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Filter which Apikeys to delete
   */
  where?: Prisma.ApikeyWhereInput
  /**
   * Limit how many Apikeys to delete.
   */
  limit?: number
}

/**
 * Apikey without action
 */
export type ApikeyDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Apikey
   */
  select?: Prisma.ApikeySelect<ExtArgs> | null
  /**
   * Omit specific fields from the Apikey
   */
  omit?: Prisma.ApikeyOmit<ExtArgs> | null
}
