/*
 * ==========================================
 * |          GENERATED BY SUPAZOD          |
 * ==========================================
 */

import { z } from "zod";
import { Json } from "./types";

export const jsonSchema: z.ZodSchema<Json> = z.lazy(() =>
  z
    .union([
      z.string(),
      z.number(),
      z.boolean(),
      z.record(z.union([jsonSchema, z.undefined()])),
      z.array(jsonSchema),
    ])
    .nullable(),
);

export const publicApikeyRowSchemaSchema = z.object({
  createdAt: z.string(),
  id: z.string(),
  keyHash: z.string(),
  keyId: z.string(),
  name: z.string(),
  userId: z.string().nullable(),
});

export const publicApikeyInsertSchemaSchema = z.object({
  createdAt: z.string().optional(),
  id: z.string(),
  keyHash: z.string(),
  keyId: z.string(),
  name: z.string(),
  userId: z.string().optional().nullable(),
});

export const publicApikeyUpdateSchemaSchema = z.object({
  createdAt: z.string().optional(),
  id: z.string().optional(),
  keyHash: z.string().optional(),
  keyId: z.string().optional(),
  name: z.string().optional(),
  userId: z.string().optional().nullable(),
});

export const publicApikeyRelationshipsSchemaSchema = z.tuple([]);

export const publicCategoriesRowSchemaSchema = z.object({
  code: z.number(),
  colorId: z.string(),
  createdAt: z.string(),
  description: z.string().nullable(),
  id: z.string(),
  name: z.string(),
  parentId: z.string().nullable(),
  userId: z.string().nullable(),
});

export const publicCategoriesInsertSchemaSchema = z.object({
  code: z.number(),
  colorId: z.string(),
  createdAt: z.string().optional(),
  description: z.string().optional().nullable(),
  id: z.string(),
  name: z.string(),
  parentId: z.string().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicCategoriesUpdateSchemaSchema = z.object({
  code: z.number().optional(),
  colorId: z.string().optional(),
  createdAt: z.string().optional(),
  description: z.string().optional().nullable(),
  id: z.string().optional(),
  name: z.string().optional(),
  parentId: z.string().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicCategoriesRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("category_colorId_color_id_fk"),
    columns: z.tuple([z.literal("colorId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("colors"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("category_parentId_category_id_fk"),
    columns: z.tuple([z.literal("parentId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("categories"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicColorsRowSchemaSchema = z.object({
  createdAt: z.string(),
  hexcode: z.string(),
  id: z.string(),
  inverse: z.string().nullable(),
  name: z.string(),
  userId: z.string().nullable(),
});

export const publicColorsInsertSchemaSchema = z.object({
  createdAt: z.string().optional(),
  hexcode: z.string(),
  id: z.string(),
  inverse: z.string().optional().nullable(),
  name: z.string(),
  userId: z.string().optional().nullable(),
});

export const publicColorsUpdateSchemaSchema = z.object({
  createdAt: z.string().optional(),
  hexcode: z.string().optional(),
  id: z.string().optional(),
  inverse: z.string().optional().nullable(),
  name: z.string().optional(),
  userId: z.string().optional().nullable(),
});

export const publicColorsRelationshipsSchemaSchema = z.tuple([]);

export const publicDaysRowSchemaSchema = z.object({
  comment: z.string().nullable(),
  date: z.string(),
  id: z.string(),
  mood: z.number().nullable(),
  userId: z.string().nullable(),
});

export const publicDaysInsertSchemaSchema = z.object({
  comment: z.string().optional().nullable(),
  date: z.string(),
  id: z.string(),
  mood: z.number().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicDaysUpdateSchemaSchema = z.object({
  comment: z.string().optional().nullable(),
  date: z.string().optional(),
  id: z.string().optional(),
  mood: z.number().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicDaysRelationshipsSchemaSchema = z.tuple([]);

export const publicHoursRowSchemaSchema = z.object({
  categoryId: z.string().nullable(),
  comment: z.string().nullable(),
  createdAt: z.string(),
  datetime: z.string().nullable(),
  dayId: z.string(),
  id: z.string(),
  userId: z.string().nullable(),
});

export const publicHoursInsertSchemaSchema = z.object({
  categoryId: z.string().optional().nullable(),
  comment: z.string().optional().nullable(),
  createdAt: z.string().optional(),
  datetime: z.string().optional().nullable(),
  dayId: z.string(),
  id: z.string(),
  userId: z.string().optional().nullable(),
});

export const publicHoursUpdateSchemaSchema = z.object({
  categoryId: z.string().optional().nullable(),
  comment: z.string().optional().nullable(),
  createdAt: z.string().optional(),
  datetime: z.string().optional().nullable(),
  dayId: z.string().optional(),
  id: z.string().optional(),
  userId: z.string().optional().nullable(),
});

export const publicHoursRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("hour_categoryId_category_id_fk"),
    columns: z.tuple([z.literal("categoryId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("categories"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("hour_dayId_day_id_fk"),
    columns: z.tuple([z.literal("dayId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("days"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicMeasurementsRowSchemaSchema = z.object({
  createdAt: z.string(),
  dayId: z.string(),
  hourId: z.string().nullable(),
  id: z.string(),
  metricId: z.string(),
  userId: z.string().nullable(),
  value: z.string(),
});

export const publicMeasurementsInsertSchemaSchema = z.object({
  createdAt: z.string().optional(),
  dayId: z.string(),
  hourId: z.string().optional().nullable(),
  id: z.string(),
  metricId: z.string(),
  userId: z.string().optional().nullable(),
  value: z.string(),
});

export const publicMeasurementsUpdateSchemaSchema = z.object({
  createdAt: z.string().optional(),
  dayId: z.string().optional(),
  hourId: z.string().optional().nullable(),
  id: z.string().optional(),
  metricId: z.string().optional(),
  userId: z.string().optional().nullable(),
  value: z.string().optional(),
});

export const publicMeasurementsRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("measurement_dayId_day_id_fk"),
    columns: z.tuple([z.literal("dayId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("days"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("measurement_hourId_hour_id_fk"),
    columns: z.tuple([z.literal("hourId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("hours"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("measurement_metricId_metric_id_fk"),
    columns: z.tuple([z.literal("metricId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("metrics"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicMetricsRowSchemaSchema = z.object({
  createdAt: z.string(),
  description: z.string().nullable(),
  goal: z.number().nullable(),
  icon: z.string(),
  id: z.string(),
  name: z.string(),
  type: z.string(),
  unit: z.string().nullable(),
  userId: z.string().nullable(),
});

export const publicMetricsInsertSchemaSchema = z.object({
  createdAt: z.string().optional(),
  description: z.string().optional().nullable(),
  goal: z.number().optional().nullable(),
  icon: z.string(),
  id: z.string(),
  name: z.string(),
  type: z.string(),
  unit: z.string().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicMetricsUpdateSchemaSchema = z.object({
  createdAt: z.string().optional(),
  description: z.string().optional().nullable(),
  goal: z.number().optional().nullable(),
  icon: z.string().optional(),
  id: z.string().optional(),
  name: z.string().optional(),
  type: z.string().optional(),
  unit: z.string().optional().nullable(),
  userId: z.string().optional().nullable(),
});

export const publicMetricsRelationshipsSchemaSchema = z.tuple([]);

export const publicSbCategoriesRowSchemaSchema = z.object({
  code: z.number(),
  colorId: z.number(),
  created_at: z.string(),
  id: z.number(),
  name: z.string(),
  userId: z.string(),
});

export const publicSbCategoriesInsertSchemaSchema = z.object({
  code: z.number(),
  colorId: z.number(),
  created_at: z.string().optional(),
  id: z.number().optional(),
  name: z.string(),
  userId: z.string(),
});

export const publicSbCategoriesUpdateSchemaSchema = z.object({
  code: z.number().optional(),
  colorId: z.number().optional(),
  created_at: z.string().optional(),
  id: z.number().optional(),
  name: z.string().optional(),
  userId: z.string().optional(),
});

export const publicSbCategoriesRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("categories_colorId_fkey"),
    columns: z.tuple([z.literal("colorId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("sb_colors"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicSbColorsRowSchemaSchema = z.object({
  hexcode: z.string(),
  id: z.number(),
  inverse: z.string(),
  name: z.string(),
  userId: z.string(),
});

export const publicSbColorsInsertSchemaSchema = z.object({
  hexcode: z.string(),
  id: z.number().optional(),
  inverse: z.string(),
  name: z.string(),
  userId: z.string(),
});

export const publicSbColorsUpdateSchemaSchema = z.object({
  hexcode: z.string().optional(),
  id: z.number().optional(),
  inverse: z.string().optional(),
  name: z.string().optional(),
  userId: z.string().optional(),
});

export const publicSbColorsRelationshipsSchemaSchema = z.tuple([]);

export const publicSbDaysRowSchemaSchema = z.object({
  comment: z.string().nullable(),
  date: z.string(),
  id: z.number(),
  mood: z.number().nullable(),
  userId: z.string(),
});

export const publicSbDaysInsertSchemaSchema = z.object({
  comment: z.string().optional().nullable(),
  date: z.string(),
  id: z.number().optional(),
  mood: z.number().optional().nullable(),
  userId: z.string(),
});

export const publicSbDaysUpdateSchemaSchema = z.object({
  comment: z.string().optional().nullable(),
  date: z.string().optional(),
  id: z.number().optional(),
  mood: z.number().optional().nullable(),
  userId: z.string().optional(),
});

export const publicSbDaysRelationshipsSchemaSchema = z.tuple([]);

export const publicSbHoursRowSchemaSchema = z.object({
  categoryId: z.number().nullable(),
  comment: z.string().nullable(),
  datetime: z.string(),
  dayId: z.number(),
  id: z.number(),
  userId: z.string().nullable(),
});

export const publicSbHoursInsertSchemaSchema = z.object({
  categoryId: z.number().optional().nullable(),
  comment: z.string().optional().nullable(),
  datetime: z.string(),
  dayId: z.number(),
  id: z.number().optional(),
  userId: z.string().optional().nullable(),
});

export const publicSbHoursUpdateSchemaSchema = z.object({
  categoryId: z.number().optional().nullable(),
  comment: z.string().optional().nullable(),
  datetime: z.string().optional(),
  dayId: z.number().optional(),
  id: z.number().optional(),
  userId: z.string().optional().nullable(),
});

export const publicSbHoursRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("hours_dayId_fkey"),
    columns: z.tuple([z.literal("dayId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("sb_days"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicSbMeasurementsRowSchemaSchema = z.object({
  created_at: z.string(),
  dayId: z.number().nullable(),
  hourId: z.number().nullable(),
  id: z.number(),
  metricId: z.number().nullable(),
  type: z.string(),
  userId: z.string().nullable(),
  value: z.string(),
});

export const publicSbMeasurementsInsertSchemaSchema = z.object({
  created_at: z.string().optional(),
  dayId: z.number().optional().nullable(),
  hourId: z.number().optional().nullable(),
  id: z.number().optional(),
  metricId: z.number().optional().nullable(),
  type: z.string().optional(),
  userId: z.string().optional().nullable(),
  value: z.string(),
});

export const publicSbMeasurementsUpdateSchemaSchema = z.object({
  created_at: z.string().optional(),
  dayId: z.number().optional().nullable(),
  hourId: z.number().optional().nullable(),
  id: z.number().optional(),
  metricId: z.number().optional().nullable(),
  type: z.string().optional(),
  userId: z.string().optional().nullable(),
  value: z.string().optional(),
});

export const publicSbMeasurementsRelationshipsSchemaSchema = z.tuple([
  z.object({
    foreignKeyName: z.literal("measurements_dayId_fkey"),
    columns: z.tuple([z.literal("dayId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("sb_days"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("measurements_hourId_fkey"),
    columns: z.tuple([z.literal("hourId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("sb_hours"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
  z.object({
    foreignKeyName: z.literal("measurements_metricId_fkey"),
    columns: z.tuple([z.literal("metricId")]),
    isOneToOne: z.literal(false),
    referencedRelation: z.literal("sb_metrics"),
    referencedColumns: z.tuple([z.literal("id")]),
  }),
]);

export const publicSbMetricsRowSchemaSchema = z.object({
  created_at: z.string(),
  description: z.string().nullable(),
  goal: z.number().nullable(),
  icon: z.string(),
  id: z.number(),
  name: z.string(),
  type: z.string(),
  unit: z.string().nullable(),
  userId: z.string(),
});

export const publicSbMetricsInsertSchemaSchema = z.object({
  created_at: z.string().optional(),
  description: z.string().optional().nullable(),
  goal: z.number().optional().nullable(),
  icon: z.string(),
  id: z.number().optional(),
  name: z.string(),
  type: z.string(),
  unit: z.string().optional().nullable(),
  userId: z.string(),
});

export const publicSbMetricsUpdateSchemaSchema = z.object({
  created_at: z.string().optional(),
  description: z.string().optional().nullable(),
  goal: z.number().optional().nullable(),
  icon: z.string().optional(),
  id: z.number().optional(),
  name: z.string().optional(),
  type: z.string().optional(),
  unit: z.string().optional().nullable(),
  userId: z.string().optional(),
});

export const publicSbMetricsRelationshipsSchemaSchema = z.tuple([]);

export const publicUserRowSchemaSchema = z.object({
  email: z.string(),
  emailVerified: z.number().nullable(),
  id: z.string(),
  image: z.string().nullable(),
  name: z.string(),
  password: z.string().nullable(),
  role: z.string().nullable(),
  timezone: z.string(),
});

export const publicUserInsertSchemaSchema = z.object({
  email: z.string(),
  emailVerified: z.number().optional().nullable(),
  id: z.string(),
  image: z.string().optional().nullable(),
  name: z.string(),
  password: z.string().optional().nullable(),
  role: z.string().optional().nullable(),
  timezone: z.string().optional(),
});

export const publicUserUpdateSchemaSchema = z.object({
  email: z.string().optional(),
  emailVerified: z.number().optional().nullable(),
  id: z.string().optional(),
  image: z.string().optional().nullable(),
  name: z.string().optional(),
  password: z.string().optional().nullable(),
  role: z.string().optional().nullable(),
  timezone: z.string().optional(),
});

export const publicUserRelationshipsSchemaSchema = z.tuple([]);
