import * as z from 'zod';
import { Prisma } from '../../../generated/prisma';
import Decimal from 'decimal.js';
import { PaymentMethodSchema } from '../enums/PaymentMethod.schema';
import { PaymentCreateNestedOneWithoutServiceLineTransactionsInputObjectSchema as PaymentCreateNestedOneWithoutServiceLineTransactionsInputObjectSchema } from './PaymentCreateNestedOneWithoutServiceLineTransactionsInput.schema'

import { DecimalJSLikeSchema, isValidDecimalInput } from '../../helpers/decimal-helpers';
const makeSchema = () => z.object({
  transactionId: z.string().optional().nullable(),
  paidAmount: z.union([
  z.number(),
  z.string(),
  z.instanceof(Decimal),
  z.instanceof(Prisma.Decimal),
  DecimalJSLikeSchema,
]).refine((v) => isValidDecimalInput(v), {
  message: "Field 'paidAmount' must be a Decimal",
}),
  adjustedAmount: z.union([
  z.number(),
  z.string(),
  z.instanceof(Decimal),
  z.instanceof(Prisma.Decimal),
  DecimalJSLikeSchema,
]).refine((v) => isValidDecimalInput(v), {
  message: "Field 'adjustedAmount' must be a Decimal",
}).optional(),
  method: PaymentMethodSchema,
  receivedDate: z.coerce.date(),
  payerName: z.string().optional().nullable(),
  notes: z.string().optional().nullable(),
  createdAt: z.coerce.date().optional(),
  payment: z.lazy(() => PaymentCreateNestedOneWithoutServiceLineTransactionsInputObjectSchema)
}).strict();
export const ServiceLineTransactionCreateWithoutServiceLineInputObjectSchema: z.ZodType<Prisma.ServiceLineTransactionCreateWithoutServiceLineInput> = makeSchema() as unknown as z.ZodType<Prisma.ServiceLineTransactionCreateWithoutServiceLineInput>;
export const ServiceLineTransactionCreateWithoutServiceLineInputObjectZodSchema = makeSchema();
