
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
/* eslint-disable */
// biome-ignore-all lint: generated file
// @ts-nocheck 
/*
 * This file exports the `Subscription` 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"
import type * as Prisma from "../internal/prismaNamespace"

/**
 * Model Subscription
 * 
 */
export type SubscriptionModel = runtime.Types.Result.DefaultSelection<Prisma.$SubscriptionPayload>

export type AggregateSubscription = {
  _count: SubscriptionCountAggregateOutputType | null
  _avg: SubscriptionAvgAggregateOutputType | null
  _sum: SubscriptionSumAggregateOutputType | null
  _min: SubscriptionMinAggregateOutputType | null
  _max: SubscriptionMaxAggregateOutputType | null
}

export type SubscriptionAvgAggregateOutputType = {
  priceCents: number | null
}

export type SubscriptionSumAggregateOutputType = {
  priceCents: number | null
}

export type SubscriptionMinAggregateOutputType = {
  id: string | null
  tenantId: string | null
  planId: string | null
  status: $Enums.SubscriptionStatus | null
  priceCents: number | null
  trialEndsAt: Date | null
  dueAt: Date | null
  startedAt: Date | null
  cancelledAt: Date | null
  provider: $Enums.BillingProvider | null
  externalCustomerId: string | null
  externalSubscriptionId: string | null
  billingType: string | null
}

export type SubscriptionMaxAggregateOutputType = {
  id: string | null
  tenantId: string | null
  planId: string | null
  status: $Enums.SubscriptionStatus | null
  priceCents: number | null
  trialEndsAt: Date | null
  dueAt: Date | null
  startedAt: Date | null
  cancelledAt: Date | null
  provider: $Enums.BillingProvider | null
  externalCustomerId: string | null
  externalSubscriptionId: string | null
  billingType: string | null
}

export type SubscriptionCountAggregateOutputType = {
  id: number
  tenantId: number
  planId: number
  status: number
  priceCents: number
  trialEndsAt: number
  dueAt: number
  startedAt: number
  cancelledAt: number
  provider: number
  externalCustomerId: number
  externalSubscriptionId: number
  billingType: number
  _all: number
}


export type SubscriptionAvgAggregateInputType = {
  priceCents?: true
}

export type SubscriptionSumAggregateInputType = {
  priceCents?: true
}

export type SubscriptionMinAggregateInputType = {
  id?: true
  tenantId?: true
  planId?: true
  status?: true
  priceCents?: true
  trialEndsAt?: true
  dueAt?: true
  startedAt?: true
  cancelledAt?: true
  provider?: true
  externalCustomerId?: true
  externalSubscriptionId?: true
  billingType?: true
}

export type SubscriptionMaxAggregateInputType = {
  id?: true
  tenantId?: true
  planId?: true
  status?: true
  priceCents?: true
  trialEndsAt?: true
  dueAt?: true
  startedAt?: true
  cancelledAt?: true
  provider?: true
  externalCustomerId?: true
  externalSubscriptionId?: true
  billingType?: true
}

export type SubscriptionCountAggregateInputType = {
  id?: true
  tenantId?: true
  planId?: true
  status?: true
  priceCents?: true
  trialEndsAt?: true
  dueAt?: true
  startedAt?: true
  cancelledAt?: true
  provider?: true
  externalCustomerId?: true
  externalSubscriptionId?: true
  billingType?: true
  _all?: true
}

export type SubscriptionAggregateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Filter which Subscription to aggregate.
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Subscriptions to fetch.
   */
  orderBy?: Prisma.SubscriptionOrderByWithRelationInput | Prisma.SubscriptionOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the start position
   */
  cursor?: Prisma.SubscriptionWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Subscriptions 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` Subscriptions.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Count returned Subscriptions
  **/
  _count?: true | SubscriptionCountAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to average
  **/
  _avg?: SubscriptionAvgAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to sum
  **/
  _sum?: SubscriptionSumAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to find the minimum value
  **/
  _min?: SubscriptionMinAggregateInputType
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
   * 
   * Select which fields to find the maximum value
  **/
  _max?: SubscriptionMaxAggregateInputType
}

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




export type SubscriptionGroupByArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  where?: Prisma.SubscriptionWhereInput
  orderBy?: Prisma.SubscriptionOrderByWithAggregationInput | Prisma.SubscriptionOrderByWithAggregationInput[]
  by: Prisma.SubscriptionScalarFieldEnum[] | Prisma.SubscriptionScalarFieldEnum
  having?: Prisma.SubscriptionScalarWhereWithAggregatesInput
  take?: number
  skip?: number
  _count?: SubscriptionCountAggregateInputType | true
  _avg?: SubscriptionAvgAggregateInputType
  _sum?: SubscriptionSumAggregateInputType
  _min?: SubscriptionMinAggregateInputType
  _max?: SubscriptionMaxAggregateInputType
}

export type SubscriptionGroupByOutputType = {
  id: string
  tenantId: string
  planId: string
  status: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt: Date | null
  dueAt: Date | null
  startedAt: Date
  cancelledAt: Date | null
  provider: $Enums.BillingProvider | null
  externalCustomerId: string | null
  externalSubscriptionId: string | null
  billingType: string | null
  _count: SubscriptionCountAggregateOutputType | null
  _avg: SubscriptionAvgAggregateOutputType | null
  _sum: SubscriptionSumAggregateOutputType | null
  _min: SubscriptionMinAggregateOutputType | null
  _max: SubscriptionMaxAggregateOutputType | null
}

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



export type SubscriptionWhereInput = {
  AND?: Prisma.SubscriptionWhereInput | Prisma.SubscriptionWhereInput[]
  OR?: Prisma.SubscriptionWhereInput[]
  NOT?: Prisma.SubscriptionWhereInput | Prisma.SubscriptionWhereInput[]
  id?: Prisma.StringFilter<"Subscription"> | string
  tenantId?: Prisma.StringFilter<"Subscription"> | string
  planId?: Prisma.StringFilter<"Subscription"> | string
  status?: Prisma.EnumSubscriptionStatusFilter<"Subscription"> | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFilter<"Subscription"> | number
  trialEndsAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  dueAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  startedAt?: Prisma.DateTimeFilter<"Subscription"> | Date | string
  cancelledAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  provider?: Prisma.EnumBillingProviderNullableFilter<"Subscription"> | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.StringNullableFilter<"Subscription"> | string | null
  externalSubscriptionId?: Prisma.StringNullableFilter<"Subscription"> | string | null
  billingType?: Prisma.StringNullableFilter<"Subscription"> | string | null
  tenant?: Prisma.XOR<Prisma.TenantScalarRelationFilter, Prisma.TenantWhereInput>
  plan?: Prisma.XOR<Prisma.PlanScalarRelationFilter, Prisma.PlanWhereInput>
  payments?: Prisma.PaymentListRelationFilter
}

export type SubscriptionOrderByWithRelationInput = {
  id?: Prisma.SortOrder
  tenantId?: Prisma.SortOrder
  planId?: Prisma.SortOrder
  status?: Prisma.SortOrder
  priceCents?: Prisma.SortOrder
  trialEndsAt?: Prisma.SortOrderInput | Prisma.SortOrder
  dueAt?: Prisma.SortOrderInput | Prisma.SortOrder
  startedAt?: Prisma.SortOrder
  cancelledAt?: Prisma.SortOrderInput | Prisma.SortOrder
  provider?: Prisma.SortOrderInput | Prisma.SortOrder
  externalCustomerId?: Prisma.SortOrderInput | Prisma.SortOrder
  externalSubscriptionId?: Prisma.SortOrderInput | Prisma.SortOrder
  billingType?: Prisma.SortOrderInput | Prisma.SortOrder
  tenant?: Prisma.TenantOrderByWithRelationInput
  plan?: Prisma.PlanOrderByWithRelationInput
  payments?: Prisma.PaymentOrderByRelationAggregateInput
}

export type SubscriptionWhereUniqueInput = Prisma.AtLeast<{
  id?: string
  tenantId?: string
  externalSubscriptionId?: string
  AND?: Prisma.SubscriptionWhereInput | Prisma.SubscriptionWhereInput[]
  OR?: Prisma.SubscriptionWhereInput[]
  NOT?: Prisma.SubscriptionWhereInput | Prisma.SubscriptionWhereInput[]
  planId?: Prisma.StringFilter<"Subscription"> | string
  status?: Prisma.EnumSubscriptionStatusFilter<"Subscription"> | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFilter<"Subscription"> | number
  trialEndsAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  dueAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  startedAt?: Prisma.DateTimeFilter<"Subscription"> | Date | string
  cancelledAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  provider?: Prisma.EnumBillingProviderNullableFilter<"Subscription"> | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.StringNullableFilter<"Subscription"> | string | null
  billingType?: Prisma.StringNullableFilter<"Subscription"> | string | null
  tenant?: Prisma.XOR<Prisma.TenantScalarRelationFilter, Prisma.TenantWhereInput>
  plan?: Prisma.XOR<Prisma.PlanScalarRelationFilter, Prisma.PlanWhereInput>
  payments?: Prisma.PaymentListRelationFilter
}, "id" | "tenantId" | "externalSubscriptionId">

export type SubscriptionOrderByWithAggregationInput = {
  id?: Prisma.SortOrder
  tenantId?: Prisma.SortOrder
  planId?: Prisma.SortOrder
  status?: Prisma.SortOrder
  priceCents?: Prisma.SortOrder
  trialEndsAt?: Prisma.SortOrderInput | Prisma.SortOrder
  dueAt?: Prisma.SortOrderInput | Prisma.SortOrder
  startedAt?: Prisma.SortOrder
  cancelledAt?: Prisma.SortOrderInput | Prisma.SortOrder
  provider?: Prisma.SortOrderInput | Prisma.SortOrder
  externalCustomerId?: Prisma.SortOrderInput | Prisma.SortOrder
  externalSubscriptionId?: Prisma.SortOrderInput | Prisma.SortOrder
  billingType?: Prisma.SortOrderInput | Prisma.SortOrder
  _count?: Prisma.SubscriptionCountOrderByAggregateInput
  _avg?: Prisma.SubscriptionAvgOrderByAggregateInput
  _max?: Prisma.SubscriptionMaxOrderByAggregateInput
  _min?: Prisma.SubscriptionMinOrderByAggregateInput
  _sum?: Prisma.SubscriptionSumOrderByAggregateInput
}

export type SubscriptionScalarWhereWithAggregatesInput = {
  AND?: Prisma.SubscriptionScalarWhereWithAggregatesInput | Prisma.SubscriptionScalarWhereWithAggregatesInput[]
  OR?: Prisma.SubscriptionScalarWhereWithAggregatesInput[]
  NOT?: Prisma.SubscriptionScalarWhereWithAggregatesInput | Prisma.SubscriptionScalarWhereWithAggregatesInput[]
  id?: Prisma.StringWithAggregatesFilter<"Subscription"> | string
  tenantId?: Prisma.StringWithAggregatesFilter<"Subscription"> | string
  planId?: Prisma.StringWithAggregatesFilter<"Subscription"> | string
  status?: Prisma.EnumSubscriptionStatusWithAggregatesFilter<"Subscription"> | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntWithAggregatesFilter<"Subscription"> | number
  trialEndsAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Subscription"> | Date | string | null
  dueAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Subscription"> | Date | string | null
  startedAt?: Prisma.DateTimeWithAggregatesFilter<"Subscription"> | Date | string
  cancelledAt?: Prisma.DateTimeNullableWithAggregatesFilter<"Subscription"> | Date | string | null
  provider?: Prisma.EnumBillingProviderNullableWithAggregatesFilter<"Subscription"> | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.StringNullableWithAggregatesFilter<"Subscription"> | string | null
  externalSubscriptionId?: Prisma.StringNullableWithAggregatesFilter<"Subscription"> | string | null
  billingType?: Prisma.StringNullableWithAggregatesFilter<"Subscription"> | string | null
}

export type SubscriptionCreateInput = {
  id?: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  tenant: Prisma.TenantCreateNestedOneWithoutSubscriptionInput
  plan: Prisma.PlanCreateNestedOneWithoutSubscriptionsInput
  payments?: Prisma.PaymentCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionUncheckedCreateInput = {
  id?: string
  tenantId: string
  planId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  payments?: Prisma.PaymentUncheckedCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionUpdateInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  tenant?: Prisma.TenantUpdateOneRequiredWithoutSubscriptionNestedInput
  plan?: Prisma.PlanUpdateOneRequiredWithoutSubscriptionsNestedInput
  payments?: Prisma.PaymentUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionUncheckedUpdateInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  tenantId?: Prisma.StringFieldUpdateOperationsInput | string
  planId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  payments?: Prisma.PaymentUncheckedUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionCreateManyInput = {
  id?: string
  tenantId: string
  planId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
}

export type SubscriptionUpdateManyMutationInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type SubscriptionUncheckedUpdateManyInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  tenantId?: Prisma.StringFieldUpdateOperationsInput | string
  planId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type SubscriptionNullableScalarRelationFilter = {
  is?: Prisma.SubscriptionWhereInput | null
  isNot?: Prisma.SubscriptionWhereInput | null
}

export type SubscriptionListRelationFilter = {
  every?: Prisma.SubscriptionWhereInput
  some?: Prisma.SubscriptionWhereInput
  none?: Prisma.SubscriptionWhereInput
}

export type SubscriptionOrderByRelationAggregateInput = {
  _count?: Prisma.SortOrder
}

export type SubscriptionCountOrderByAggregateInput = {
  id?: Prisma.SortOrder
  tenantId?: Prisma.SortOrder
  planId?: Prisma.SortOrder
  status?: Prisma.SortOrder
  priceCents?: Prisma.SortOrder
  trialEndsAt?: Prisma.SortOrder
  dueAt?: Prisma.SortOrder
  startedAt?: Prisma.SortOrder
  cancelledAt?: Prisma.SortOrder
  provider?: Prisma.SortOrder
  externalCustomerId?: Prisma.SortOrder
  externalSubscriptionId?: Prisma.SortOrder
  billingType?: Prisma.SortOrder
}

export type SubscriptionAvgOrderByAggregateInput = {
  priceCents?: Prisma.SortOrder
}

export type SubscriptionMaxOrderByAggregateInput = {
  id?: Prisma.SortOrder
  tenantId?: Prisma.SortOrder
  planId?: Prisma.SortOrder
  status?: Prisma.SortOrder
  priceCents?: Prisma.SortOrder
  trialEndsAt?: Prisma.SortOrder
  dueAt?: Prisma.SortOrder
  startedAt?: Prisma.SortOrder
  cancelledAt?: Prisma.SortOrder
  provider?: Prisma.SortOrder
  externalCustomerId?: Prisma.SortOrder
  externalSubscriptionId?: Prisma.SortOrder
  billingType?: Prisma.SortOrder
}

export type SubscriptionMinOrderByAggregateInput = {
  id?: Prisma.SortOrder
  tenantId?: Prisma.SortOrder
  planId?: Prisma.SortOrder
  status?: Prisma.SortOrder
  priceCents?: Prisma.SortOrder
  trialEndsAt?: Prisma.SortOrder
  dueAt?: Prisma.SortOrder
  startedAt?: Prisma.SortOrder
  cancelledAt?: Prisma.SortOrder
  provider?: Prisma.SortOrder
  externalCustomerId?: Prisma.SortOrder
  externalSubscriptionId?: Prisma.SortOrder
  billingType?: Prisma.SortOrder
}

export type SubscriptionSumOrderByAggregateInput = {
  priceCents?: Prisma.SortOrder
}

export type SubscriptionScalarRelationFilter = {
  is?: Prisma.SubscriptionWhereInput
  isNot?: Prisma.SubscriptionWhereInput
}

export type SubscriptionCreateNestedOneWithoutTenantInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutTenantInput
  connect?: Prisma.SubscriptionWhereUniqueInput
}

export type SubscriptionUncheckedCreateNestedOneWithoutTenantInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutTenantInput
  connect?: Prisma.SubscriptionWhereUniqueInput
}

export type SubscriptionUpdateOneWithoutTenantNestedInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutTenantInput
  upsert?: Prisma.SubscriptionUpsertWithoutTenantInput
  disconnect?: Prisma.SubscriptionWhereInput | boolean
  delete?: Prisma.SubscriptionWhereInput | boolean
  connect?: Prisma.SubscriptionWhereUniqueInput
  update?: Prisma.XOR<Prisma.XOR<Prisma.SubscriptionUpdateToOneWithWhereWithoutTenantInput, Prisma.SubscriptionUpdateWithoutTenantInput>, Prisma.SubscriptionUncheckedUpdateWithoutTenantInput>
}

export type SubscriptionUncheckedUpdateOneWithoutTenantNestedInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutTenantInput
  upsert?: Prisma.SubscriptionUpsertWithoutTenantInput
  disconnect?: Prisma.SubscriptionWhereInput | boolean
  delete?: Prisma.SubscriptionWhereInput | boolean
  connect?: Prisma.SubscriptionWhereUniqueInput
  update?: Prisma.XOR<Prisma.XOR<Prisma.SubscriptionUpdateToOneWithWhereWithoutTenantInput, Prisma.SubscriptionUpdateWithoutTenantInput>, Prisma.SubscriptionUncheckedUpdateWithoutTenantInput>
}

export type SubscriptionCreateNestedManyWithoutPlanInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput> | Prisma.SubscriptionCreateWithoutPlanInput[] | Prisma.SubscriptionUncheckedCreateWithoutPlanInput[]
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPlanInput | Prisma.SubscriptionCreateOrConnectWithoutPlanInput[]
  createMany?: Prisma.SubscriptionCreateManyPlanInputEnvelope
  connect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
}

export type SubscriptionUncheckedCreateNestedManyWithoutPlanInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput> | Prisma.SubscriptionCreateWithoutPlanInput[] | Prisma.SubscriptionUncheckedCreateWithoutPlanInput[]
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPlanInput | Prisma.SubscriptionCreateOrConnectWithoutPlanInput[]
  createMany?: Prisma.SubscriptionCreateManyPlanInputEnvelope
  connect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
}

export type SubscriptionUpdateManyWithoutPlanNestedInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput> | Prisma.SubscriptionCreateWithoutPlanInput[] | Prisma.SubscriptionUncheckedCreateWithoutPlanInput[]
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPlanInput | Prisma.SubscriptionCreateOrConnectWithoutPlanInput[]
  upsert?: Prisma.SubscriptionUpsertWithWhereUniqueWithoutPlanInput | Prisma.SubscriptionUpsertWithWhereUniqueWithoutPlanInput[]
  createMany?: Prisma.SubscriptionCreateManyPlanInputEnvelope
  set?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  disconnect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  delete?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  connect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  update?: Prisma.SubscriptionUpdateWithWhereUniqueWithoutPlanInput | Prisma.SubscriptionUpdateWithWhereUniqueWithoutPlanInput[]
  updateMany?: Prisma.SubscriptionUpdateManyWithWhereWithoutPlanInput | Prisma.SubscriptionUpdateManyWithWhereWithoutPlanInput[]
  deleteMany?: Prisma.SubscriptionScalarWhereInput | Prisma.SubscriptionScalarWhereInput[]
}

export type SubscriptionUncheckedUpdateManyWithoutPlanNestedInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput> | Prisma.SubscriptionCreateWithoutPlanInput[] | Prisma.SubscriptionUncheckedCreateWithoutPlanInput[]
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPlanInput | Prisma.SubscriptionCreateOrConnectWithoutPlanInput[]
  upsert?: Prisma.SubscriptionUpsertWithWhereUniqueWithoutPlanInput | Prisma.SubscriptionUpsertWithWhereUniqueWithoutPlanInput[]
  createMany?: Prisma.SubscriptionCreateManyPlanInputEnvelope
  set?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  disconnect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  delete?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  connect?: Prisma.SubscriptionWhereUniqueInput | Prisma.SubscriptionWhereUniqueInput[]
  update?: Prisma.SubscriptionUpdateWithWhereUniqueWithoutPlanInput | Prisma.SubscriptionUpdateWithWhereUniqueWithoutPlanInput[]
  updateMany?: Prisma.SubscriptionUpdateManyWithWhereWithoutPlanInput | Prisma.SubscriptionUpdateManyWithWhereWithoutPlanInput[]
  deleteMany?: Prisma.SubscriptionScalarWhereInput | Prisma.SubscriptionScalarWhereInput[]
}

export type EnumSubscriptionStatusFieldUpdateOperationsInput = {
  set?: $Enums.SubscriptionStatus
}

export type NullableEnumBillingProviderFieldUpdateOperationsInput = {
  set?: $Enums.BillingProvider | null
}

export type SubscriptionCreateNestedOneWithoutPaymentsInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPaymentsInput, Prisma.SubscriptionUncheckedCreateWithoutPaymentsInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPaymentsInput
  connect?: Prisma.SubscriptionWhereUniqueInput
}

export type SubscriptionUpdateOneRequiredWithoutPaymentsNestedInput = {
  create?: Prisma.XOR<Prisma.SubscriptionCreateWithoutPaymentsInput, Prisma.SubscriptionUncheckedCreateWithoutPaymentsInput>
  connectOrCreate?: Prisma.SubscriptionCreateOrConnectWithoutPaymentsInput
  upsert?: Prisma.SubscriptionUpsertWithoutPaymentsInput
  connect?: Prisma.SubscriptionWhereUniqueInput
  update?: Prisma.XOR<Prisma.XOR<Prisma.SubscriptionUpdateToOneWithWhereWithoutPaymentsInput, Prisma.SubscriptionUpdateWithoutPaymentsInput>, Prisma.SubscriptionUncheckedUpdateWithoutPaymentsInput>
}

export type SubscriptionCreateWithoutTenantInput = {
  id?: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  plan: Prisma.PlanCreateNestedOneWithoutSubscriptionsInput
  payments?: Prisma.PaymentCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionUncheckedCreateWithoutTenantInput = {
  id?: string
  planId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  payments?: Prisma.PaymentUncheckedCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionCreateOrConnectWithoutTenantInput = {
  where: Prisma.SubscriptionWhereUniqueInput
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
}

export type SubscriptionUpsertWithoutTenantInput = {
  update: Prisma.XOR<Prisma.SubscriptionUpdateWithoutTenantInput, Prisma.SubscriptionUncheckedUpdateWithoutTenantInput>
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutTenantInput, Prisma.SubscriptionUncheckedCreateWithoutTenantInput>
  where?: Prisma.SubscriptionWhereInput
}

export type SubscriptionUpdateToOneWithWhereWithoutTenantInput = {
  where?: Prisma.SubscriptionWhereInput
  data: Prisma.XOR<Prisma.SubscriptionUpdateWithoutTenantInput, Prisma.SubscriptionUncheckedUpdateWithoutTenantInput>
}

export type SubscriptionUpdateWithoutTenantInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  plan?: Prisma.PlanUpdateOneRequiredWithoutSubscriptionsNestedInput
  payments?: Prisma.PaymentUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionUncheckedUpdateWithoutTenantInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  planId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  payments?: Prisma.PaymentUncheckedUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionCreateWithoutPlanInput = {
  id?: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  tenant: Prisma.TenantCreateNestedOneWithoutSubscriptionInput
  payments?: Prisma.PaymentCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionUncheckedCreateWithoutPlanInput = {
  id?: string
  tenantId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  payments?: Prisma.PaymentUncheckedCreateNestedManyWithoutSubscriptionInput
}

export type SubscriptionCreateOrConnectWithoutPlanInput = {
  where: Prisma.SubscriptionWhereUniqueInput
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput>
}

export type SubscriptionCreateManyPlanInputEnvelope = {
  data: Prisma.SubscriptionCreateManyPlanInput | Prisma.SubscriptionCreateManyPlanInput[]
  skipDuplicates?: boolean
}

export type SubscriptionUpsertWithWhereUniqueWithoutPlanInput = {
  where: Prisma.SubscriptionWhereUniqueInput
  update: Prisma.XOR<Prisma.SubscriptionUpdateWithoutPlanInput, Prisma.SubscriptionUncheckedUpdateWithoutPlanInput>
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutPlanInput, Prisma.SubscriptionUncheckedCreateWithoutPlanInput>
}

export type SubscriptionUpdateWithWhereUniqueWithoutPlanInput = {
  where: Prisma.SubscriptionWhereUniqueInput
  data: Prisma.XOR<Prisma.SubscriptionUpdateWithoutPlanInput, Prisma.SubscriptionUncheckedUpdateWithoutPlanInput>
}

export type SubscriptionUpdateManyWithWhereWithoutPlanInput = {
  where: Prisma.SubscriptionScalarWhereInput
  data: Prisma.XOR<Prisma.SubscriptionUpdateManyMutationInput, Prisma.SubscriptionUncheckedUpdateManyWithoutPlanInput>
}

export type SubscriptionScalarWhereInput = {
  AND?: Prisma.SubscriptionScalarWhereInput | Prisma.SubscriptionScalarWhereInput[]
  OR?: Prisma.SubscriptionScalarWhereInput[]
  NOT?: Prisma.SubscriptionScalarWhereInput | Prisma.SubscriptionScalarWhereInput[]
  id?: Prisma.StringFilter<"Subscription"> | string
  tenantId?: Prisma.StringFilter<"Subscription"> | string
  planId?: Prisma.StringFilter<"Subscription"> | string
  status?: Prisma.EnumSubscriptionStatusFilter<"Subscription"> | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFilter<"Subscription"> | number
  trialEndsAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  dueAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  startedAt?: Prisma.DateTimeFilter<"Subscription"> | Date | string
  cancelledAt?: Prisma.DateTimeNullableFilter<"Subscription"> | Date | string | null
  provider?: Prisma.EnumBillingProviderNullableFilter<"Subscription"> | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.StringNullableFilter<"Subscription"> | string | null
  externalSubscriptionId?: Prisma.StringNullableFilter<"Subscription"> | string | null
  billingType?: Prisma.StringNullableFilter<"Subscription"> | string | null
}

export type SubscriptionCreateWithoutPaymentsInput = {
  id?: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
  tenant: Prisma.TenantCreateNestedOneWithoutSubscriptionInput
  plan: Prisma.PlanCreateNestedOneWithoutSubscriptionsInput
}

export type SubscriptionUncheckedCreateWithoutPaymentsInput = {
  id?: string
  tenantId: string
  planId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
}

export type SubscriptionCreateOrConnectWithoutPaymentsInput = {
  where: Prisma.SubscriptionWhereUniqueInput
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutPaymentsInput, Prisma.SubscriptionUncheckedCreateWithoutPaymentsInput>
}

export type SubscriptionUpsertWithoutPaymentsInput = {
  update: Prisma.XOR<Prisma.SubscriptionUpdateWithoutPaymentsInput, Prisma.SubscriptionUncheckedUpdateWithoutPaymentsInput>
  create: Prisma.XOR<Prisma.SubscriptionCreateWithoutPaymentsInput, Prisma.SubscriptionUncheckedCreateWithoutPaymentsInput>
  where?: Prisma.SubscriptionWhereInput
}

export type SubscriptionUpdateToOneWithWhereWithoutPaymentsInput = {
  where?: Prisma.SubscriptionWhereInput
  data: Prisma.XOR<Prisma.SubscriptionUpdateWithoutPaymentsInput, Prisma.SubscriptionUncheckedUpdateWithoutPaymentsInput>
}

export type SubscriptionUpdateWithoutPaymentsInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  tenant?: Prisma.TenantUpdateOneRequiredWithoutSubscriptionNestedInput
  plan?: Prisma.PlanUpdateOneRequiredWithoutSubscriptionsNestedInput
}

export type SubscriptionUncheckedUpdateWithoutPaymentsInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  tenantId?: Prisma.StringFieldUpdateOperationsInput | string
  planId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}

export type SubscriptionCreateManyPlanInput = {
  id?: string
  tenantId: string
  status?: $Enums.SubscriptionStatus
  priceCents: number
  trialEndsAt?: Date | string | null
  dueAt?: Date | string | null
  startedAt?: Date | string
  cancelledAt?: Date | string | null
  provider?: $Enums.BillingProvider | null
  externalCustomerId?: string | null
  externalSubscriptionId?: string | null
  billingType?: string | null
}

export type SubscriptionUpdateWithoutPlanInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  tenant?: Prisma.TenantUpdateOneRequiredWithoutSubscriptionNestedInput
  payments?: Prisma.PaymentUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionUncheckedUpdateWithoutPlanInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  tenantId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  payments?: Prisma.PaymentUncheckedUpdateManyWithoutSubscriptionNestedInput
}

export type SubscriptionUncheckedUpdateManyWithoutPlanInput = {
  id?: Prisma.StringFieldUpdateOperationsInput | string
  tenantId?: Prisma.StringFieldUpdateOperationsInput | string
  status?: Prisma.EnumSubscriptionStatusFieldUpdateOperationsInput | $Enums.SubscriptionStatus
  priceCents?: Prisma.IntFieldUpdateOperationsInput | number
  trialEndsAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  dueAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  startedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
  cancelledAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
  provider?: Prisma.NullableEnumBillingProviderFieldUpdateOperationsInput | $Enums.BillingProvider | null
  externalCustomerId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  externalSubscriptionId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
  billingType?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
}


/**
 * Count Type SubscriptionCountOutputType
 */

export type SubscriptionCountOutputType = {
  payments: number
}

export type SubscriptionCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  payments?: boolean | SubscriptionCountOutputTypeCountPaymentsArgs
}

/**
 * SubscriptionCountOutputType without action
 */
export type SubscriptionCountOutputTypeDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the SubscriptionCountOutputType
   */
  select?: Prisma.SubscriptionCountOutputTypeSelect<ExtArgs> | null
}

/**
 * SubscriptionCountOutputType without action
 */
export type SubscriptionCountOutputTypeCountPaymentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  where?: Prisma.PaymentWhereInput
}


export type SubscriptionSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  tenantId?: boolean
  planId?: boolean
  status?: boolean
  priceCents?: boolean
  trialEndsAt?: boolean
  dueAt?: boolean
  startedAt?: boolean
  cancelledAt?: boolean
  provider?: boolean
  externalCustomerId?: boolean
  externalSubscriptionId?: boolean
  billingType?: boolean
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
  payments?: boolean | Prisma.Subscription$paymentsArgs<ExtArgs>
  _count?: boolean | Prisma.SubscriptionCountOutputTypeDefaultArgs<ExtArgs>
}, ExtArgs["result"]["subscription"]>

export type SubscriptionSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  tenantId?: boolean
  planId?: boolean
  status?: boolean
  priceCents?: boolean
  trialEndsAt?: boolean
  dueAt?: boolean
  startedAt?: boolean
  cancelledAt?: boolean
  provider?: boolean
  externalCustomerId?: boolean
  externalSubscriptionId?: boolean
  billingType?: boolean
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
}, ExtArgs["result"]["subscription"]>

export type SubscriptionSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
  id?: boolean
  tenantId?: boolean
  planId?: boolean
  status?: boolean
  priceCents?: boolean
  trialEndsAt?: boolean
  dueAt?: boolean
  startedAt?: boolean
  cancelledAt?: boolean
  provider?: boolean
  externalCustomerId?: boolean
  externalSubscriptionId?: boolean
  billingType?: boolean
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
}, ExtArgs["result"]["subscription"]>

export type SubscriptionSelectScalar = {
  id?: boolean
  tenantId?: boolean
  planId?: boolean
  status?: boolean
  priceCents?: boolean
  trialEndsAt?: boolean
  dueAt?: boolean
  startedAt?: boolean
  cancelledAt?: boolean
  provider?: boolean
  externalCustomerId?: boolean
  externalSubscriptionId?: boolean
  billingType?: boolean
}

export type SubscriptionOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "tenantId" | "planId" | "status" | "priceCents" | "trialEndsAt" | "dueAt" | "startedAt" | "cancelledAt" | "provider" | "externalCustomerId" | "externalSubscriptionId" | "billingType", ExtArgs["result"]["subscription"]>
export type SubscriptionInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
  payments?: boolean | Prisma.Subscription$paymentsArgs<ExtArgs>
  _count?: boolean | Prisma.SubscriptionCountOutputTypeDefaultArgs<ExtArgs>
}
export type SubscriptionIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
}
export type SubscriptionIncludeUpdateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  tenant?: boolean | Prisma.TenantDefaultArgs<ExtArgs>
  plan?: boolean | Prisma.PlanDefaultArgs<ExtArgs>
}

export type $SubscriptionPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  name: "Subscription"
  objects: {
    tenant: Prisma.$TenantPayload<ExtArgs>
    plan: Prisma.$PlanPayload<ExtArgs>
    payments: Prisma.$PaymentPayload<ExtArgs>[]
  }
  scalars: runtime.Types.Extensions.GetPayloadResult<{
    id: string
    tenantId: string
    planId: string
    status: $Enums.SubscriptionStatus
    priceCents: number
    trialEndsAt: Date | null
    dueAt: Date | null
    startedAt: Date
    cancelledAt: Date | null
    provider: $Enums.BillingProvider | null
    externalCustomerId: string | null
    externalSubscriptionId: string | null
    billingType: string | null
  }, ExtArgs["result"]["subscription"]>
  composites: {}
}

export type SubscriptionGetPayload<S extends boolean | null | undefined | SubscriptionDefaultArgs> = runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload, S>

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

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

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

  /**
   * Find the first Subscription 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 {SubscriptionFindFirstArgs} args - Arguments to find a Subscription
   * @example
   * // Get one Subscription
   * const subscription = await prisma.subscription.findFirst({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findFirst<T extends SubscriptionFindFirstArgs>(args?: Prisma.SelectSubset<T, SubscriptionFindFirstArgs<ExtArgs>>): Prisma.Prisma__SubscriptionClient<runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload<ExtArgs>, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>

  /**
   * Find the first Subscription 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 {SubscriptionFindFirstOrThrowArgs} args - Arguments to find a Subscription
   * @example
   * // Get one Subscription
   * const subscription = await prisma.subscription.findFirstOrThrow({
   *   where: {
   *     // ... provide filter here
   *   }
   * })
   */
  findFirstOrThrow<T extends SubscriptionFindFirstOrThrowArgs>(args?: Prisma.SelectSubset<T, SubscriptionFindFirstOrThrowArgs<ExtArgs>>): Prisma.Prisma__SubscriptionClient<runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload<ExtArgs>, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions>

  /**
   * Find zero or more Subscriptions 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 {SubscriptionFindManyArgs} args - Arguments to filter and select certain fields only.
   * @example
   * // Get all Subscriptions
   * const subscriptions = await prisma.subscription.findMany()
   * 
   * // Get first 10 Subscriptions
   * const subscriptions = await prisma.subscription.findMany({ take: 10 })
   * 
   * // Only select the `id`
   * const subscriptionWithIdOnly = await prisma.subscription.findMany({ select: { id: true } })
   * 
   */
  findMany<T extends SubscriptionFindManyArgs>(args?: Prisma.SelectSubset<T, SubscriptionFindManyArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions>>

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

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

  /**
   * Create many Subscriptions and returns the data saved in the database.
   * @param {SubscriptionCreateManyAndReturnArgs} args - Arguments to create many Subscriptions.
   * @example
   * // Create many Subscriptions
   * const subscription = await prisma.subscription.createManyAndReturn({
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * 
   * // Create many Subscriptions and only return the `id`
   * const subscriptionWithIdOnly = await prisma.subscription.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 SubscriptionCreateManyAndReturnArgs>(args?: Prisma.SelectSubset<T, SubscriptionCreateManyAndReturnArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload<ExtArgs>, T, "createManyAndReturn", GlobalOmitOptions>>

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

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

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

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

  /**
   * Update zero or more Subscriptions and returns the data updated in the database.
   * @param {SubscriptionUpdateManyAndReturnArgs} args - Arguments to update many Subscriptions.
   * @example
   * // Update many Subscriptions
   * const subscription = await prisma.subscription.updateManyAndReturn({
   *   where: {
   *     // ... provide filter here
   *   },
   *   data: [
   *     // ... provide data here
   *   ]
   * })
   * 
   * // Update zero or more Subscriptions and only return the `id`
   * const subscriptionWithIdOnly = await prisma.subscription.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 SubscriptionUpdateManyAndReturnArgs>(args: Prisma.SelectSubset<T, SubscriptionUpdateManyAndReturnArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SubscriptionPayload<ExtArgs>, T, "updateManyAndReturn", GlobalOmitOptions>>

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


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

  /**
   * Allows you to perform aggregations operations on a Subscription.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {SubscriptionAggregateArgs} 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 SubscriptionAggregateArgs>(args: Prisma.Subset<T, SubscriptionAggregateArgs>): Prisma.PrismaPromise<GetSubscriptionAggregateType<T>>

  /**
   * Group by Subscription.
   * Note, that providing `undefined` is treated as the value not being there.
   * Read more here: https://pris.ly/d/null-undefined
   * @param {SubscriptionGroupByArgs} 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 SubscriptionGroupByArgs,
    HasSelectOrTake extends Prisma.Or<
      Prisma.Extends<'skip', Prisma.Keys<T>>,
      Prisma.Extends<'take', Prisma.Keys<T>>
    >,
    OrderByArg extends Prisma.True extends HasSelectOrTake
      ? { orderBy: SubscriptionGroupByArgs['orderBy'] }
      : { orderBy?: SubscriptionGroupByArgs['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, SubscriptionGroupByArgs, OrderByArg> & InputErrors): {} extends InputErrors ? GetSubscriptionGroupByPayload<T> : Prisma.PrismaPromise<InputErrors>
/**
 * Fields of the Subscription model
 */
readonly fields: SubscriptionFieldRefs;
}

/**
 * The delegate class that acts as a "Promise-like" for Subscription.
 * 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__SubscriptionClient<T, Null = never, ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs, GlobalOmitOptions = {}> extends Prisma.PrismaPromise<T> {
  readonly [Symbol.toStringTag]: "PrismaPromise"
  tenant<T extends Prisma.TenantDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.TenantDefaultArgs<ExtArgs>>): Prisma.Prisma__TenantClient<runtime.Types.Result.GetResult<Prisma.$TenantPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
  plan<T extends Prisma.PlanDefaultArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.PlanDefaultArgs<ExtArgs>>): Prisma.Prisma__PlanClient<runtime.Types.Result.GetResult<Prisma.$PlanPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions>
  payments<T extends Prisma.Subscription$paymentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Subscription$paymentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PaymentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
  /**
   * 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 Subscription model
 */
export interface SubscriptionFieldRefs {
  readonly id: Prisma.FieldRef<"Subscription", 'String'>
  readonly tenantId: Prisma.FieldRef<"Subscription", 'String'>
  readonly planId: Prisma.FieldRef<"Subscription", 'String'>
  readonly status: Prisma.FieldRef<"Subscription", 'SubscriptionStatus'>
  readonly priceCents: Prisma.FieldRef<"Subscription", 'Int'>
  readonly trialEndsAt: Prisma.FieldRef<"Subscription", 'DateTime'>
  readonly dueAt: Prisma.FieldRef<"Subscription", 'DateTime'>
  readonly startedAt: Prisma.FieldRef<"Subscription", 'DateTime'>
  readonly cancelledAt: Prisma.FieldRef<"Subscription", 'DateTime'>
  readonly provider: Prisma.FieldRef<"Subscription", 'BillingProvider'>
  readonly externalCustomerId: Prisma.FieldRef<"Subscription", 'String'>
  readonly externalSubscriptionId: Prisma.FieldRef<"Subscription", 'String'>
  readonly billingType: Prisma.FieldRef<"Subscription", 'String'>
}
    

// Custom InputTypes
/**
 * Subscription findUnique
 */
export type SubscriptionFindUniqueArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter, which Subscription to fetch.
   */
  where: Prisma.SubscriptionWhereUniqueInput
}

/**
 * Subscription findUniqueOrThrow
 */
export type SubscriptionFindUniqueOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter, which Subscription to fetch.
   */
  where: Prisma.SubscriptionWhereUniqueInput
}

/**
 * Subscription findFirst
 */
export type SubscriptionFindFirstArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter, which Subscription to fetch.
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Subscriptions to fetch.
   */
  orderBy?: Prisma.SubscriptionOrderByWithRelationInput | Prisma.SubscriptionOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for searching for Subscriptions.
   */
  cursor?: Prisma.SubscriptionWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Subscriptions 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` Subscriptions.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Subscriptions.
   */
  distinct?: Prisma.SubscriptionScalarFieldEnum | Prisma.SubscriptionScalarFieldEnum[]
}

/**
 * Subscription findFirstOrThrow
 */
export type SubscriptionFindFirstOrThrowArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter, which Subscription to fetch.
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Subscriptions to fetch.
   */
  orderBy?: Prisma.SubscriptionOrderByWithRelationInput | Prisma.SubscriptionOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for searching for Subscriptions.
   */
  cursor?: Prisma.SubscriptionWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Subscriptions 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` Subscriptions.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Subscriptions.
   */
  distinct?: Prisma.SubscriptionScalarFieldEnum | Prisma.SubscriptionScalarFieldEnum[]
}

/**
 * Subscription findMany
 */
export type SubscriptionFindManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter, which Subscriptions to fetch.
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}
   * 
   * Determine the order of Subscriptions to fetch.
   */
  orderBy?: Prisma.SubscriptionOrderByWithRelationInput | Prisma.SubscriptionOrderByWithRelationInput[]
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}
   * 
   * Sets the position for listing Subscriptions.
   */
  cursor?: Prisma.SubscriptionWhereUniqueInput
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}
   * 
   * Take `±n` Subscriptions 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` Subscriptions.
   */
  skip?: number
  /**
   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}
   * 
   * Filter by unique combinations of Subscriptions.
   */
  distinct?: Prisma.SubscriptionScalarFieldEnum | Prisma.SubscriptionScalarFieldEnum[]
}

/**
 * Subscription create
 */
export type SubscriptionCreateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * The data needed to create a Subscription.
   */
  data: Prisma.XOR<Prisma.SubscriptionCreateInput, Prisma.SubscriptionUncheckedCreateInput>
}

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

/**
 * Subscription createManyAndReturn
 */
export type SubscriptionCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelectCreateManyAndReturn<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * The data used to create many Subscriptions.
   */
  data: Prisma.SubscriptionCreateManyInput | Prisma.SubscriptionCreateManyInput[]
  skipDuplicates?: boolean
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionIncludeCreateManyAndReturn<ExtArgs> | null
}

/**
 * Subscription update
 */
export type SubscriptionUpdateArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * The data needed to update a Subscription.
   */
  data: Prisma.XOR<Prisma.SubscriptionUpdateInput, Prisma.SubscriptionUncheckedUpdateInput>
  /**
   * Choose, which Subscription to update.
   */
  where: Prisma.SubscriptionWhereUniqueInput
}

/**
 * Subscription updateMany
 */
export type SubscriptionUpdateManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * The data used to update Subscriptions.
   */
  data: Prisma.XOR<Prisma.SubscriptionUpdateManyMutationInput, Prisma.SubscriptionUncheckedUpdateManyInput>
  /**
   * Filter which Subscriptions to update
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * Limit how many Subscriptions to update.
   */
  limit?: number
}

/**
 * Subscription updateManyAndReturn
 */
export type SubscriptionUpdateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelectUpdateManyAndReturn<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * The data used to update Subscriptions.
   */
  data: Prisma.XOR<Prisma.SubscriptionUpdateManyMutationInput, Prisma.SubscriptionUncheckedUpdateManyInput>
  /**
   * Filter which Subscriptions to update
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * Limit how many Subscriptions to update.
   */
  limit?: number
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionIncludeUpdateManyAndReturn<ExtArgs> | null
}

/**
 * Subscription upsert
 */
export type SubscriptionUpsertArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * The filter to search for the Subscription to update in case it exists.
   */
  where: Prisma.SubscriptionWhereUniqueInput
  /**
   * In case the Subscription found by the `where` argument doesn't exist, create a new Subscription with this data.
   */
  create: Prisma.XOR<Prisma.SubscriptionCreateInput, Prisma.SubscriptionUncheckedCreateInput>
  /**
   * In case the Subscription was found with the provided `where` argument, update it with this data.
   */
  update: Prisma.XOR<Prisma.SubscriptionUpdateInput, Prisma.SubscriptionUncheckedUpdateInput>
}

/**
 * Subscription delete
 */
export type SubscriptionDeleteArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
  /**
   * Filter which Subscription to delete.
   */
  where: Prisma.SubscriptionWhereUniqueInput
}

/**
 * Subscription deleteMany
 */
export type SubscriptionDeleteManyArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Filter which Subscriptions to delete
   */
  where?: Prisma.SubscriptionWhereInput
  /**
   * Limit how many Subscriptions to delete.
   */
  limit?: number
}

/**
 * Subscription.payments
 */
export type Subscription$paymentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Payment
   */
  select?: Prisma.PaymentSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Payment
   */
  omit?: Prisma.PaymentOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.PaymentInclude<ExtArgs> | null
  where?: Prisma.PaymentWhereInput
  orderBy?: Prisma.PaymentOrderByWithRelationInput | Prisma.PaymentOrderByWithRelationInput[]
  cursor?: Prisma.PaymentWhereUniqueInput
  take?: number
  skip?: number
  distinct?: Prisma.PaymentScalarFieldEnum | Prisma.PaymentScalarFieldEnum[]
}

/**
 * Subscription without action
 */
export type SubscriptionDefaultArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
  /**
   * Select specific fields to fetch from the Subscription
   */
  select?: Prisma.SubscriptionSelect<ExtArgs> | null
  /**
   * Omit specific fields from the Subscription
   */
  omit?: Prisma.SubscriptionOmit<ExtArgs> | null
  /**
   * Choose, which related nodes to fetch as well
   */
  include?: Prisma.SubscriptionInclude<ExtArgs> | null
}
