// This file is auto-generated by @hey-api/openapi-ts

import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
  zGetBillingInvoicesResponse,
  zGetBillingSubscriptionQuery,
  zGetBillingSubscriptionResponse,
  zPutBillingPartnersByPartnerKeyTenantsBody,
  zPutBillingPartnersByPartnerKeyTenantsPath,
  zPutBillingPartnersByPartnerKeyTenantsResponse,
} from './zod.gen'

export const get = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getBillingInvoices',
    path: '/billing/invoices',
    tags: ['console'],
  })
  .output(zGetBillingInvoicesResponse)

export const invoices = {
  get,
}

/**
 * Sync partner tenants bindings
 */
export const put = oc
  .route({
    description: 'Sync partner tenants bindings',
    inputStructure: 'detailed',
    method: 'PUT',
    operationId: 'putBillingPartnersByPartnerKeyTenants',
    path: '/billing/partners/{partner_key}/tenants',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPutBillingPartnersByPartnerKeyTenantsBody,
      params: zPutBillingPartnersByPartnerKeyTenantsPath,
    }),
  )
  .output(zPutBillingPartnersByPartnerKeyTenantsResponse)

export const tenants = {
  put,
}

export const byPartnerKey = {
  tenants,
}

export const partners = {
  byPartnerKey,
}

export const get2 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getBillingSubscription',
    path: '/billing/subscription',
    tags: ['console'],
  })
  .input(z.object({ query: zGetBillingSubscriptionQuery }))
  .output(zGetBillingSubscriptionResponse)

export const subscription = {
  get: get2,
}

export const billing = {
  invoices,
  partners,
  subscription,
}

export const contract = {
  billing,
}
