import { z } from "zod";
import { Identifier } from "../id.js";
import { Examples } from "../examples.js";

export namespace App {
  export const Info = z
    .object({
      id: Identifier.schema("app").meta({
        description: "The unique identifier of the App",
        example: Examples.App.id,
      }),
      name: z.string().meta({
        description: "The name of the App",
        example: Examples.App.name,
      }),
      redirectURI: z.url().meta({
        description: "Redirect endpoint URL of the App",
        example: Examples.App.redirectURI,
      }),
      secret: z.string().meta({
        description: "Auth2.0 client secret key of the App (obfuscated)",
        example: Examples.App.secret,
      }),
    })
    .meta({
      ref: "App",
      description: "Represents an App for OAuth2.0 authentication",
      example: Examples.App,
    });

  export type Info = z.infer<typeof Info>;
}
