import { z } from 'zod';
import { APIResponseSchema } from "../api.js";
import { ProjectResponseError } from "./util.js";
// --- GET hostname ---
export const ProjectHostnameGetRequestSchema = z.object({
    projectId: z.string().describe('the project id'),
});
const HostnameGetDataSchema = z.object({
    hostname: z
        .string()
        .nullable()
        .describe('The vanity hostname for the project, or null if not set.'),
    url: z
        .string()
        .nullable()
        .describe('The full URL for the project hostname, or null if not set.'),
});
const ProjectHostnameGetResponseSchema = APIResponseSchema(HostnameGetDataSchema);
export async function projectHostnameGet(client, request) {
    const resp = await client.get(`/cli/project/${request.projectId}/hostname`, ProjectHostnameGetResponseSchema);
    if (resp.success) {
        return resp.data;
    }
    throw new ProjectResponseError({ message: resp.message });
}
// --- SET hostname ---
export const ProjectHostnameSetRequestSchema = z.object({
    projectId: z.string().describe('the project id'),
    hostname: z.string().describe('the vanity hostname to set'),
});
const HostnameSetDataSchema = z.object({
    hostname: z.string().describe('The vanity hostname that was set.'),
    url: z.string().describe('The full URL for the project hostname.'),
});
const ProjectHostnameSetResponseSchema = APIResponseSchema(HostnameSetDataSchema);
export async function projectHostnameSet(client, request) {
    const resp = await client.put(`/cli/project/${request.projectId}/hostname`, { hostname: request.hostname }, ProjectHostnameSetResponseSchema);
    if (resp.success) {
        return resp.data;
    }
    throw new ProjectResponseError({ message: resp.message });
}
//# sourceMappingURL=hostname.js.map