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

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

/**
 * A Vercel Container Registry repository.
 */
export type VcrRepository = {
  /**
   * Unique identifier of the repository.
   */
  id: string;
  /**
   * Identifier of the project the repository belongs to.
   */
  projectId: string;
  /**
   * Name of the repository.
   */
  name: string;
  /**
   * Whether the repository is public. Images in public repositories can be pulled by anyone. Defaults to `false` (private).
   */
  public: boolean;
  /**
   * ISO 8601 timestamp of when the repository was created.
   */
  createdAt: string;
  /**
   * ISO 8601 timestamp of when the repository was last updated.
   */
  updatedAt: string;
};

/** @internal */
export const VcrRepository$inboundSchema: z.ZodType<
  VcrRepository,
  z.ZodTypeDef,
  unknown
> = z.object({
  id: types.string(),
  projectId: types.string(),
  name: types.string(),
  public: types.boolean(),
  createdAt: types.string(),
  updatedAt: types.string(),
});

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