/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * A high-level, AI-generated summary of an agreement document.
 */
export type AgreementSummary = {
  /**
   * An AI-generated summary of the agreement. This summary is provided for convenience
   *
   * @remarks
   * and may not capture every detail of the original agreement.
   */
  summary?: string | undefined;
};

/** @internal */
export const AgreementSummary$inboundSchema: z.ZodType<
  AgreementSummary,
  z.ZodTypeDef,
  unknown
> = z.object({
  summary: z.string().optional(),
});

/** @internal */
export type AgreementSummary$Outbound = {
  summary?: string | undefined;
};

/** @internal */
export const AgreementSummary$outboundSchema: z.ZodType<
  AgreementSummary$Outbound,
  z.ZodTypeDef,
  AgreementSummary
> = z.object({
  summary: z.string().optional(),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace AgreementSummary$ {
  /** @deprecated use `AgreementSummary$inboundSchema` instead. */
  export const inboundSchema = AgreementSummary$inboundSchema;
  /** @deprecated use `AgreementSummary$outboundSchema` instead. */
  export const outboundSchema = AgreementSummary$outboundSchema;
  /** @deprecated use `AgreementSummary$Outbound` instead. */
  export type Outbound = AgreementSummary$Outbound;
}

export function agreementSummaryToJSON(
  agreementSummary: AgreementSummary,
): string {
  return JSON.stringify(
    AgreementSummary$outboundSchema.parse(agreementSummary),
  );
}

export function agreementSummaryFromJSON(
  jsonString: string,
): SafeParseResult<AgreementSummary, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => AgreementSummary$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'AgreementSummary' from JSON`,
  );
}
