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

import { oc } from '@orpc/contract'
import * as z from 'zod'

import {
  zDeleteAdminDeleteExploreBannerByBannerIdPath,
  zDeleteAdminDeleteExploreBannerByBannerIdResponse,
  zDeleteAdminInsertExploreAppsByAppIdPath,
  zDeleteAdminInsertExploreAppsByAppIdResponse,
  zPostAdminBatchAddNotificationAccountsResponse,
  zPostAdminInsertExploreAppsBody,
  zPostAdminInsertExploreAppsResponse,
  zPostAdminInsertExploreBannerBody,
  zPostAdminInsertExploreBannerResponse,
  zPostAdminUpsertNotificationBody,
  zPostAdminUpsertNotificationResponse,
} from './zod.gen'

/**
 * Register target accounts for a notification by email address. JSON body: {"notification_id": "...", "user_email": ["a@example.com", ...]}. File upload: multipart/form-data with a 'file' field (CSV or TXT, one email per line) plus a 'notification_id' field. Emails that do not match any account are silently skipped.
 */
export const post = oc
  .route({
    description:
      'Register target accounts for a notification by email address. JSON body: {"notification_id": "...", "user_email": ["a@example.com", ...]}. File upload: multipart/form-data with a \'file\' field (CSV or TXT, one email per line) plus a \'notification_id\' field. Emails that do not match any account are silently skipped.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAdminBatchAddNotificationAccounts',
    path: '/admin/batch_add_notification_accounts',
    tags: ['console'],
  })
  .output(zPostAdminBatchAddNotificationAccountsResponse)

export const batchAddNotificationAccounts = {
  post,
}

/**
 * Delete an explore banner
 */
export const delete_ = oc
  .route({
    description: 'Delete an explore banner',
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteAdminDeleteExploreBannerByBannerId',
    path: '/admin/delete-explore-banner/{banner_id}',
    successStatus: 204,
    tags: ['console'],
  })
  .input(z.object({ params: zDeleteAdminDeleteExploreBannerByBannerIdPath }))
  .output(zDeleteAdminDeleteExploreBannerByBannerIdResponse)

export const byBannerId = {
  delete: delete_,
}

export const deleteExploreBanner = {
  byBannerId,
}

/**
 * Remove an app from the explore list
 */
export const delete2 = oc
  .route({
    description: 'Remove an app from the explore list',
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteAdminInsertExploreAppsByAppId',
    path: '/admin/insert-explore-apps/{app_id}',
    successStatus: 204,
    tags: ['console'],
  })
  .input(z.object({ params: zDeleteAdminInsertExploreAppsByAppIdPath }))
  .output(zDeleteAdminInsertExploreAppsByAppIdResponse)

export const byAppId = {
  delete: delete2,
}

/**
 * Insert or update an app in the explore list
 */
export const post2 = oc
  .route({
    description: 'Insert or update an app in the explore list',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAdminInsertExploreApps',
    path: '/admin/insert-explore-apps',
    tags: ['console'],
  })
  .input(z.object({ body: zPostAdminInsertExploreAppsBody }))
  .output(zPostAdminInsertExploreAppsResponse)

export const insertExploreApps = {
  post: post2,
  byAppId,
}

/**
 * Insert an explore banner
 */
export const post3 = oc
  .route({
    description: 'Insert an explore banner',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAdminInsertExploreBanner',
    path: '/admin/insert-explore-banner',
    successStatus: 201,
    tags: ['console'],
  })
  .input(z.object({ body: zPostAdminInsertExploreBannerBody }))
  .output(zPostAdminInsertExploreBannerResponse)

export const insertExploreBanner = {
  post: post3,
}

/**
 * Create or update an in-product notification. Supply notification_id to update an existing one; omit it to create a new one. Pass at least one language variant in contents (zh / en / jp).
 */
export const post4 = oc
  .route({
    description:
      'Create or update an in-product notification. Supply notification_id to update an existing one; omit it to create a new one. Pass at least one language variant in contents (zh / en / jp).',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAdminUpsertNotification',
    path: '/admin/upsert_notification',
    tags: ['console'],
  })
  .input(z.object({ body: zPostAdminUpsertNotificationBody }))
  .output(zPostAdminUpsertNotificationResponse)

export const upsertNotification = {
  post: post4,
}

export const admin = {
  batchAddNotificationAccounts,
  deleteExploreBanner,
  insertExploreApps,
  insertExploreBanner,
  upsertNotification,
}

export const contract = {
  admin,
}
