/* tslint:disable */
/* eslint-disable */
/**
 * This file was automatically generated by Payload.
 * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
 * and re-run `payload generate:db-schema` to regenerate this file.
 */

import type {} from '@payloadcms/db-postgres';
import {
  pgTable,
  index,
  uniqueIndex,
  foreignKey,
  integer,
  varchar,
  timestamp,
  serial,
  numeric,
  jsonb,
  boolean,
  pgEnum,
} from '@payloadcms/db-postgres/drizzle/pg-core';
import { sql, relations } from '@payloadcms/db-postgres/drizzle';
export const enum_posts_locale = pgEnum('enum_posts_locale', ['en', 'de']);
export const enum_posts_status = pgEnum('enum_posts_status', ['draft', 'published']);
export const enum__posts_v_version_locale = pgEnum('enum__posts_v_version_locale', ['en', 'de']);
export const enum__posts_v_version_status = pgEnum('enum__posts_v_version_status', [
  'draft',
  'published',
]);
export const enum_form_submissions_type = pgEnum('enum_form_submissions_type', [
  'contact',
  'product_quote',
]);
export const enum_products_locale = pgEnum('enum_products_locale', ['en', 'de']);
export const enum_products_status = pgEnum('enum_products_status', ['draft', 'published']);
export const enum__products_v_version_locale = pgEnum('enum__products_v_version_locale', [
  'en',
  'de',
]);
export const enum__products_v_version_status = pgEnum('enum__products_v_version_status', [
  'draft',
  'published',
]);

export const users_sessions = pgTable(
  'users_sessions',
  {
    _order: integer('_order').notNull(),
    _parentID: integer('_parent_id').notNull(),
    id: varchar('id').primaryKey(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 }),
    expiresAt: timestamp('expires_at', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }).notNull(),
  },
  (columns) => [
    index('users_sessions_order_idx').on(columns._order),
    index('users_sessions_parent_id_idx').on(columns._parentID),
    foreignKey({
      columns: [columns['_parentID']],
      foreignColumns: [users.id],
      name: 'users_sessions_parent_id_fk',
    }).onDelete('cascade'),
  ],
);

export const users = pgTable(
  'users',
  {
    id: serial('id').primaryKey(),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    email: varchar('email').notNull(),
    resetPasswordToken: varchar('reset_password_token'),
    resetPasswordExpiration: timestamp('reset_password_expiration', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }),
    salt: varchar('salt'),
    hash: varchar('hash'),
    loginAttempts: numeric('login_attempts', { mode: 'number' }).default(0),
    lockUntil: timestamp('lock_until', { mode: 'string', withTimezone: true, precision: 3 }),
  },
  (columns) => [
    index('users_updated_at_idx').on(columns.updatedAt),
    index('users_created_at_idx').on(columns.createdAt),
    uniqueIndex('users_email_idx').on(columns.email),
  ],
);

export const media = pgTable(
  'media',
  {
    id: serial('id').primaryKey(),
    alt: varchar('alt').notNull(),
    caption: varchar('caption'),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    url: varchar('url'),
    thumbnailURL: varchar('thumbnail_u_r_l'),
    filename: varchar('filename'),
    mimeType: varchar('mime_type'),
    filesize: numeric('filesize', { mode: 'number' }),
    width: numeric('width', { mode: 'number' }),
    height: numeric('height', { mode: 'number' }),
    focalX: numeric('focal_x', { mode: 'number' }),
    focalY: numeric('focal_y', { mode: 'number' }),
    sizes_thumbnail_url: varchar('sizes_thumbnail_url'),
    sizes_thumbnail_width: numeric('sizes_thumbnail_width', { mode: 'number' }),
    sizes_thumbnail_height: numeric('sizes_thumbnail_height', { mode: 'number' }),
    sizes_thumbnail_mimeType: varchar('sizes_thumbnail_mime_type'),
    sizes_thumbnail_filesize: numeric('sizes_thumbnail_filesize', { mode: 'number' }),
    sizes_thumbnail_filename: varchar('sizes_thumbnail_filename'),
    sizes_card_url: varchar('sizes_card_url'),
    sizes_card_width: numeric('sizes_card_width', { mode: 'number' }),
    sizes_card_height: numeric('sizes_card_height', { mode: 'number' }),
    sizes_card_mimeType: varchar('sizes_card_mime_type'),
    sizes_card_filesize: numeric('sizes_card_filesize', { mode: 'number' }),
    sizes_card_filename: varchar('sizes_card_filename'),
    sizes_hero_url: varchar('sizes_hero_url'),
    sizes_hero_width: numeric('sizes_hero_width', { mode: 'number' }),
    sizes_hero_height: numeric('sizes_hero_height', { mode: 'number' }),
    sizes_hero_mimeType: varchar('sizes_hero_mime_type'),
    sizes_hero_filesize: numeric('sizes_hero_filesize', { mode: 'number' }),
    sizes_hero_filename: varchar('sizes_hero_filename'),
    sizes_hero_mobile_url: varchar('sizes_hero_mobile_url'),
    sizes_hero_mobile_width: numeric('sizes_hero_mobile_width', { mode: 'number' }),
    sizes_hero_mobile_height: numeric('sizes_hero_mobile_height', { mode: 'number' }),
    sizes_hero_mobile_mimeType: varchar('sizes_hero_mobile_mime_type'),
    sizes_hero_mobile_filesize: numeric('sizes_hero_mobile_filesize', { mode: 'number' }),
    sizes_hero_mobile_filename: varchar('sizes_hero_mobile_filename'),
  },
  (columns) => [
    index('media_updated_at_idx').on(columns.updatedAt),
    index('media_created_at_idx').on(columns.createdAt),
    uniqueIndex('media_filename_idx').on(columns.filename),
    index('media_sizes_thumbnail_sizes_thumbnail_filename_idx').on(
      columns.sizes_thumbnail_filename,
    ),
    index('media_sizes_card_sizes_card_filename_idx').on(columns.sizes_card_filename),
    index('media_sizes_hero_sizes_hero_filename_idx').on(columns.sizes_hero_filename),
    index('media_sizes_hero_mobile_sizes_hero_mobile_filename_idx').on(
      columns.sizes_hero_mobile_filename,
    ),
  ],
);

export const posts = pgTable(
  'posts',
  {
    id: serial('id').primaryKey(),
    title: varchar('title'),
    slug: varchar('slug'),
    excerpt: varchar('excerpt'),
    date: timestamp('date', { mode: 'string', withTimezone: true, precision: 3 }),
    featuredImage: integer('featured_image_id').references(() => media.id, {
      onDelete: 'set null',
    }),
    locale: enum_posts_locale('locale').default('en'),
    category: varchar('category'),
    content: jsonb('content'),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    _status: enum_posts_status('_status').default('draft'),
  },
  (columns) => [
    uniqueIndex('posts_slug_idx').on(columns.slug),
    index('posts_featured_image_idx').on(columns.featuredImage),
    index('posts_updated_at_idx').on(columns.updatedAt),
    index('posts_created_at_idx').on(columns.createdAt),
    index('posts__status_idx').on(columns._status),
  ],
);

export const _posts_v = pgTable(
  '_posts_v',
  {
    id: serial('id').primaryKey(),
    parent: integer('parent_id').references(() => posts.id, {
      onDelete: 'set null',
    }),
    version_title: varchar('version_title'),
    version_slug: varchar('version_slug'),
    version_excerpt: varchar('version_excerpt'),
    version_date: timestamp('version_date', { mode: 'string', withTimezone: true, precision: 3 }),
    version_featuredImage: integer('version_featured_image_id').references(() => media.id, {
      onDelete: 'set null',
    }),
    version_locale: enum__posts_v_version_locale('version_locale').default('en'),
    version_category: varchar('version_category'),
    version_content: jsonb('version_content'),
    version_updatedAt: timestamp('version_updated_at', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }),
    version_createdAt: timestamp('version_created_at', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }),
    version__status: enum__posts_v_version_status('version__status').default('draft'),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    latest: boolean('latest'),
  },
  (columns) => [
    index('_posts_v_parent_idx').on(columns.parent),
    index('_posts_v_version_version_slug_idx').on(columns.version_slug),
    index('_posts_v_version_version_featured_image_idx').on(columns.version_featuredImage),
    index('_posts_v_version_version_updated_at_idx').on(columns.version_updatedAt),
    index('_posts_v_version_version_created_at_idx').on(columns.version_createdAt),
    index('_posts_v_version_version__status_idx').on(columns.version__status),
    index('_posts_v_created_at_idx').on(columns.createdAt),
    index('_posts_v_updated_at_idx').on(columns.updatedAt),
    index('_posts_v_latest_idx').on(columns.latest),
  ],
);

export const form_submissions = pgTable(
  'form_submissions',
  {
    id: serial('id').primaryKey(),
    name: varchar('name').notNull(),
    email: varchar('email').notNull(),
    type: enum_form_submissions_type('type').notNull(),
    productName: varchar('product_name'),
    message: varchar('message').notNull(),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
  },
  (columns) => [
    index('form_submissions_updated_at_idx').on(columns.updatedAt),
    index('form_submissions_created_at_idx').on(columns.createdAt),
  ],
);

export const products_categories = pgTable(
  'products_categories',
  {
    _order: integer('_order').notNull(),
    _parentID: integer('_parent_id').notNull(),
    id: varchar('id').primaryKey(),
    category: varchar('category'),
  },
  (columns) => [
    index('products_categories_order_idx').on(columns._order),
    index('products_categories_parent_id_idx').on(columns._parentID),
    foreignKey({
      columns: [columns['_parentID']],
      foreignColumns: [products.id],
      name: 'products_categories_parent_id_fk',
    }).onDelete('cascade'),
  ],
);

export const products = pgTable(
  'products',
  {
    id: serial('id').primaryKey(),
    title: varchar('title'),
    sku: varchar('sku'),
    slug: varchar('slug'),
    description: varchar('description'),
    locale: enum_products_locale('locale').default('de'),
    application: jsonb('application'),
    content: jsonb('content'),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    _status: enum_products_status('_status').default('draft'),
  },
  (columns) => [
    uniqueIndex('products_sku_idx').on(columns.sku),
    index('products_updated_at_idx').on(columns.updatedAt),
    index('products_created_at_idx').on(columns.createdAt),
    index('products__status_idx').on(columns._status),
  ],
);

export const products_rels = pgTable(
  'products_rels',
  {
    id: serial('id').primaryKey(),
    order: integer('order'),
    parent: integer('parent_id').notNull(),
    path: varchar('path').notNull(),
    mediaID: integer('media_id'),
  },
  (columns) => [
    index('products_rels_order_idx').on(columns.order),
    index('products_rels_parent_idx').on(columns.parent),
    index('products_rels_path_idx').on(columns.path),
    index('products_rels_media_id_idx').on(columns.mediaID),
    foreignKey({
      columns: [columns['parent']],
      foreignColumns: [products.id],
      name: 'products_rels_parent_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['mediaID']],
      foreignColumns: [media.id],
      name: 'products_rels_media_fk',
    }).onDelete('cascade'),
  ],
);

export const _products_v_version_categories = pgTable(
  '_products_v_version_categories',
  {
    _order: integer('_order').notNull(),
    _parentID: integer('_parent_id').notNull(),
    id: serial('id').primaryKey(),
    category: varchar('category'),
    _uuid: varchar('_uuid'),
  },
  (columns) => [
    index('_products_v_version_categories_order_idx').on(columns._order),
    index('_products_v_version_categories_parent_id_idx').on(columns._parentID),
    foreignKey({
      columns: [columns['_parentID']],
      foreignColumns: [_products_v.id],
      name: '_products_v_version_categories_parent_id_fk',
    }).onDelete('cascade'),
  ],
);

export const _products_v = pgTable(
  '_products_v',
  {
    id: serial('id').primaryKey(),
    parent: integer('parent_id').references(() => products.id, {
      onDelete: 'set null',
    }),
    version_title: varchar('version_title'),
    version_sku: varchar('version_sku'),
    version_slug: varchar('version_slug'),
    version_description: varchar('version_description'),
    version_locale: enum__products_v_version_locale('version_locale').default('de'),
    version_application: jsonb('version_application'),
    version_content: jsonb('version_content'),
    version_updatedAt: timestamp('version_updated_at', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }),
    version_createdAt: timestamp('version_created_at', {
      mode: 'string',
      withTimezone: true,
      precision: 3,
    }),
    version__status: enum__products_v_version_status('version__status').default('draft'),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    latest: boolean('latest'),
  },
  (columns) => [
    index('_products_v_parent_idx').on(columns.parent),
    index('_products_v_version_version_sku_idx').on(columns.version_sku),
    index('_products_v_version_version_updated_at_idx').on(columns.version_updatedAt),
    index('_products_v_version_version_created_at_idx').on(columns.version_createdAt),
    index('_products_v_version_version__status_idx').on(columns.version__status),
    index('_products_v_created_at_idx').on(columns.createdAt),
    index('_products_v_updated_at_idx').on(columns.updatedAt),
    index('_products_v_latest_idx').on(columns.latest),
  ],
);

export const _products_v_rels = pgTable(
  '_products_v_rels',
  {
    id: serial('id').primaryKey(),
    order: integer('order'),
    parent: integer('parent_id').notNull(),
    path: varchar('path').notNull(),
    mediaID: integer('media_id'),
  },
  (columns) => [
    index('_products_v_rels_order_idx').on(columns.order),
    index('_products_v_rels_parent_idx').on(columns.parent),
    index('_products_v_rels_path_idx').on(columns.path),
    index('_products_v_rels_media_id_idx').on(columns.mediaID),
    foreignKey({
      columns: [columns['parent']],
      foreignColumns: [_products_v.id],
      name: '_products_v_rels_parent_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['mediaID']],
      foreignColumns: [media.id],
      name: '_products_v_rels_media_fk',
    }).onDelete('cascade'),
  ],
);

export const payload_kv = pgTable(
  'payload_kv',
  {
    id: serial('id').primaryKey(),
    key: varchar('key').notNull(),
    data: jsonb('data').notNull(),
  },
  (columns) => [uniqueIndex('payload_kv_key_idx').on(columns.key)],
);

export const payload_locked_documents = pgTable(
  'payload_locked_documents',
  {
    id: serial('id').primaryKey(),
    globalSlug: varchar('global_slug'),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
  },
  (columns) => [
    index('payload_locked_documents_global_slug_idx').on(columns.globalSlug),
    index('payload_locked_documents_updated_at_idx').on(columns.updatedAt),
    index('payload_locked_documents_created_at_idx').on(columns.createdAt),
  ],
);

export const payload_locked_documents_rels = pgTable(
  'payload_locked_documents_rels',
  {
    id: serial('id').primaryKey(),
    order: integer('order'),
    parent: integer('parent_id').notNull(),
    path: varchar('path').notNull(),
    usersID: integer('users_id'),
    mediaID: integer('media_id'),
    postsID: integer('posts_id'),
    'form-submissionsID': integer('form_submissions_id'),
    productsID: integer('products_id'),
  },
  (columns) => [
    index('payload_locked_documents_rels_order_idx').on(columns.order),
    index('payload_locked_documents_rels_parent_idx').on(columns.parent),
    index('payload_locked_documents_rels_path_idx').on(columns.path),
    index('payload_locked_documents_rels_users_id_idx').on(columns.usersID),
    index('payload_locked_documents_rels_media_id_idx').on(columns.mediaID),
    index('payload_locked_documents_rels_posts_id_idx').on(columns.postsID),
    index('payload_locked_documents_rels_form_submissions_id_idx').on(
      columns['form-submissionsID'],
    ),
    index('payload_locked_documents_rels_products_id_idx').on(columns.productsID),
    foreignKey({
      columns: [columns['parent']],
      foreignColumns: [payload_locked_documents.id],
      name: 'payload_locked_documents_rels_parent_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['usersID']],
      foreignColumns: [users.id],
      name: 'payload_locked_documents_rels_users_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['mediaID']],
      foreignColumns: [media.id],
      name: 'payload_locked_documents_rels_media_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['postsID']],
      foreignColumns: [posts.id],
      name: 'payload_locked_documents_rels_posts_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['form-submissionsID']],
      foreignColumns: [form_submissions.id],
      name: 'payload_locked_documents_rels_form_submissions_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['productsID']],
      foreignColumns: [products.id],
      name: 'payload_locked_documents_rels_products_fk',
    }).onDelete('cascade'),
  ],
);

export const payload_preferences = pgTable(
  'payload_preferences',
  {
    id: serial('id').primaryKey(),
    key: varchar('key'),
    value: jsonb('value'),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
  },
  (columns) => [
    index('payload_preferences_key_idx').on(columns.key),
    index('payload_preferences_updated_at_idx').on(columns.updatedAt),
    index('payload_preferences_created_at_idx').on(columns.createdAt),
  ],
);

export const payload_preferences_rels = pgTable(
  'payload_preferences_rels',
  {
    id: serial('id').primaryKey(),
    order: integer('order'),
    parent: integer('parent_id').notNull(),
    path: varchar('path').notNull(),
    usersID: integer('users_id'),
  },
  (columns) => [
    index('payload_preferences_rels_order_idx').on(columns.order),
    index('payload_preferences_rels_parent_idx').on(columns.parent),
    index('payload_preferences_rels_path_idx').on(columns.path),
    index('payload_preferences_rels_users_id_idx').on(columns.usersID),
    foreignKey({
      columns: [columns['parent']],
      foreignColumns: [payload_preferences.id],
      name: 'payload_preferences_rels_parent_fk',
    }).onDelete('cascade'),
    foreignKey({
      columns: [columns['usersID']],
      foreignColumns: [users.id],
      name: 'payload_preferences_rels_users_fk',
    }).onDelete('cascade'),
  ],
);

export const payload_migrations = pgTable(
  'payload_migrations',
  {
    id: serial('id').primaryKey(),
    name: varchar('name'),
    batch: numeric('batch', { mode: 'number' }),
    updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
    createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 })
      .defaultNow()
      .notNull(),
  },
  (columns) => [
    index('payload_migrations_updated_at_idx').on(columns.updatedAt),
    index('payload_migrations_created_at_idx').on(columns.createdAt),
  ],
);

export const relations_users_sessions = relations(users_sessions, ({ one }) => ({
  _parentID: one(users, {
    fields: [users_sessions._parentID],
    references: [users.id],
    relationName: 'sessions',
  }),
}));
export const relations_users = relations(users, ({ many }) => ({
  sessions: many(users_sessions, {
    relationName: 'sessions',
  }),
}));
export const relations_media = relations(media, () => ({}));
export const relations_posts = relations(posts, ({ one }) => ({
  featuredImage: one(media, {
    fields: [posts.featuredImage],
    references: [media.id],
    relationName: 'featuredImage',
  }),
}));
export const relations__posts_v = relations(_posts_v, ({ one }) => ({
  parent: one(posts, {
    fields: [_posts_v.parent],
    references: [posts.id],
    relationName: 'parent',
  }),
  version_featuredImage: one(media, {
    fields: [_posts_v.version_featuredImage],
    references: [media.id],
    relationName: 'version_featuredImage',
  }),
}));
export const relations_form_submissions = relations(form_submissions, () => ({}));
export const relations_products_categories = relations(products_categories, ({ one }) => ({
  _parentID: one(products, {
    fields: [products_categories._parentID],
    references: [products.id],
    relationName: 'categories',
  }),
}));
export const relations_products_rels = relations(products_rels, ({ one }) => ({
  parent: one(products, {
    fields: [products_rels.parent],
    references: [products.id],
    relationName: '_rels',
  }),
  mediaID: one(media, {
    fields: [products_rels.mediaID],
    references: [media.id],
    relationName: 'media',
  }),
}));
export const relations_products = relations(products, ({ many }) => ({
  categories: many(products_categories, {
    relationName: 'categories',
  }),
  _rels: many(products_rels, {
    relationName: '_rels',
  }),
}));
export const relations__products_v_version_categories = relations(
  _products_v_version_categories,
  ({ one }) => ({
    _parentID: one(_products_v, {
      fields: [_products_v_version_categories._parentID],
      references: [_products_v.id],
      relationName: 'version_categories',
    }),
  }),
);
export const relations__products_v_rels = relations(_products_v_rels, ({ one }) => ({
  parent: one(_products_v, {
    fields: [_products_v_rels.parent],
    references: [_products_v.id],
    relationName: '_rels',
  }),
  mediaID: one(media, {
    fields: [_products_v_rels.mediaID],
    references: [media.id],
    relationName: 'media',
  }),
}));
export const relations__products_v = relations(_products_v, ({ one, many }) => ({
  parent: one(products, {
    fields: [_products_v.parent],
    references: [products.id],
    relationName: 'parent',
  }),
  version_categories: many(_products_v_version_categories, {
    relationName: 'version_categories',
  }),
  _rels: many(_products_v_rels, {
    relationName: '_rels',
  }),
}));
export const relations_payload_kv = relations(payload_kv, () => ({}));
export const relations_payload_locked_documents_rels = relations(
  payload_locked_documents_rels,
  ({ one }) => ({
    parent: one(payload_locked_documents, {
      fields: [payload_locked_documents_rels.parent],
      references: [payload_locked_documents.id],
      relationName: '_rels',
    }),
    usersID: one(users, {
      fields: [payload_locked_documents_rels.usersID],
      references: [users.id],
      relationName: 'users',
    }),
    mediaID: one(media, {
      fields: [payload_locked_documents_rels.mediaID],
      references: [media.id],
      relationName: 'media',
    }),
    postsID: one(posts, {
      fields: [payload_locked_documents_rels.postsID],
      references: [posts.id],
      relationName: 'posts',
    }),
    'form-submissionsID': one(form_submissions, {
      fields: [payload_locked_documents_rels['form-submissionsID']],
      references: [form_submissions.id],
      relationName: 'form-submissions',
    }),
    productsID: one(products, {
      fields: [payload_locked_documents_rels.productsID],
      references: [products.id],
      relationName: 'products',
    }),
  }),
);
export const relations_payload_locked_documents = relations(
  payload_locked_documents,
  ({ many }) => ({
    _rels: many(payload_locked_documents_rels, {
      relationName: '_rels',
    }),
  }),
);
export const relations_payload_preferences_rels = relations(
  payload_preferences_rels,
  ({ one }) => ({
    parent: one(payload_preferences, {
      fields: [payload_preferences_rels.parent],
      references: [payload_preferences.id],
      relationName: '_rels',
    }),
    usersID: one(users, {
      fields: [payload_preferences_rels.usersID],
      references: [users.id],
      relationName: 'users',
    }),
  }),
);
export const relations_payload_preferences = relations(payload_preferences, ({ many }) => ({
  _rels: many(payload_preferences_rels, {
    relationName: '_rels',
  }),
}));
export const relations_payload_migrations = relations(payload_migrations, () => ({}));

type DatabaseSchema = {
  enum_posts_locale: typeof enum_posts_locale;
  enum_posts_status: typeof enum_posts_status;
  enum__posts_v_version_locale: typeof enum__posts_v_version_locale;
  enum__posts_v_version_status: typeof enum__posts_v_version_status;
  enum_form_submissions_type: typeof enum_form_submissions_type;
  enum_products_locale: typeof enum_products_locale;
  enum_products_status: typeof enum_products_status;
  enum__products_v_version_locale: typeof enum__products_v_version_locale;
  enum__products_v_version_status: typeof enum__products_v_version_status;
  users_sessions: typeof users_sessions;
  users: typeof users;
  media: typeof media;
  posts: typeof posts;
  _posts_v: typeof _posts_v;
  form_submissions: typeof form_submissions;
  products_categories: typeof products_categories;
  products: typeof products;
  products_rels: typeof products_rels;
  _products_v_version_categories: typeof _products_v_version_categories;
  _products_v: typeof _products_v;
  _products_v_rels: typeof _products_v_rels;
  payload_kv: typeof payload_kv;
  payload_locked_documents: typeof payload_locked_documents;
  payload_locked_documents_rels: typeof payload_locked_documents_rels;
  payload_preferences: typeof payload_preferences;
  payload_preferences_rels: typeof payload_preferences_rels;
  payload_migrations: typeof payload_migrations;
  relations_users_sessions: typeof relations_users_sessions;
  relations_users: typeof relations_users;
  relations_media: typeof relations_media;
  relations_posts: typeof relations_posts;
  relations__posts_v: typeof relations__posts_v;
  relations_form_submissions: typeof relations_form_submissions;
  relations_products_categories: typeof relations_products_categories;
  relations_products_rels: typeof relations_products_rels;
  relations_products: typeof relations_products;
  relations__products_v_version_categories: typeof relations__products_v_version_categories;
  relations__products_v_rels: typeof relations__products_v_rels;
  relations__products_v: typeof relations__products_v;
  relations_payload_kv: typeof relations_payload_kv;
  relations_payload_locked_documents_rels: typeof relations_payload_locked_documents_rels;
  relations_payload_locked_documents: typeof relations_payload_locked_documents;
  relations_payload_preferences_rels: typeof relations_payload_preferences_rels;
  relations_payload_preferences: typeof relations_payload_preferences;
  relations_payload_migrations: typeof relations_payload_migrations;
};

declare module '@payloadcms/db-postgres' {
  export interface GeneratedDatabaseSchema {
    schema: DatabaseSchema;
  }
}
