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

import * as z from "zod/v3";
import { ClosedEnum } from "../../types/enums.js";

export const GithubRepositoryInType = {
  Github: "github",
} as const;
export type GithubRepositoryInType = ClosedEnum<typeof GithubRepositoryInType>;

export type GithubRepositoryIn = {
  type?: GithubRepositoryInType | undefined;
  name: string;
  owner: string;
  ref?: string | null | undefined;
  weight?: number | undefined;
  token: string;
};

/** @internal */
export const GithubRepositoryInType$outboundSchema: z.ZodNativeEnum<
  typeof GithubRepositoryInType
> = z.nativeEnum(GithubRepositoryInType);

/** @internal */
export type GithubRepositoryIn$Outbound = {
  type: string;
  name: string;
  owner: string;
  ref?: string | null | undefined;
  weight: number;
  token: string;
};

/** @internal */
export const GithubRepositoryIn$outboundSchema: z.ZodType<
  GithubRepositoryIn$Outbound,
  z.ZodTypeDef,
  GithubRepositoryIn
> = z.object({
  type: GithubRepositoryInType$outboundSchema.default("github"),
  name: z.string(),
  owner: z.string(),
  ref: z.nullable(z.string()).optional(),
  weight: z.number().default(1),
  token: z.string(),
});

export function githubRepositoryInToJSON(
  githubRepositoryIn: GithubRepositoryIn,
): string {
  return JSON.stringify(
    GithubRepositoryIn$outboundSchema.parse(githubRepositoryIn),
  );
}
