"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoadmapResponseSchema = exports.RoadmapFacetsSchema = exports.RoadmapPaginationSchema = exports.RoadmapQuerySchema = exports.RoadmapItemSchema = exports.RoadmapItemPriority = exports.RoadmapItemStatus = exports.ROADMAP_DEFAULT_PAGE_SIZE = void 0;
const zod_1 = require("zod");
exports.ROADMAP_DEFAULT_PAGE_SIZE = 100;
var RoadmapItemStatus;
(function (RoadmapItemStatus) {
    RoadmapItemStatus["BACKLOG"] = "Backlog";
    RoadmapItemStatus["BUILDING"] = "Building";
    RoadmapItemStatus["SHIPPED"] = "Shipped";
    RoadmapItemStatus["CANCELED"] = "Canceled";
})(RoadmapItemStatus || (exports.RoadmapItemStatus = RoadmapItemStatus = {}));
var RoadmapItemPriority;
(function (RoadmapItemPriority) {
    RoadmapItemPriority["URGENT"] = "Urgent";
    RoadmapItemPriority["HIGH"] = "High";
    RoadmapItemPriority["MEDIUM"] = "Medium";
    RoadmapItemPriority["LOW"] = "Low";
    RoadmapItemPriority["NO_PRIORITY"] = "No priority";
})(RoadmapItemPriority || (exports.RoadmapItemPriority = RoadmapItemPriority = {}));
const githubIssueUrlSchema = zod_1.z
    .string()
    .regex(/^https:\/\/github\.com\/lightdash\/lightdash\/issues\/\d+\/?$/, 'Expected a public lightdash/lightdash issue URL');
const githubPullRequestUrlSchema = zod_1.z
    .string()
    .regex(/^https:\/\/github\.com\/lightdash\/lightdash\/pull\/\d+\/?$/, 'Expected a public lightdash/lightdash pull request URL');
exports.RoadmapItemSchema = zod_1.z
    .object({
    ticketId: zod_1.z.string().min(1).max(255),
    title: zod_1.z.string().min(1),
    description: zod_1.z.string().nullable(),
    status: zod_1.z.nativeEnum(RoadmapItemStatus),
    priority: zod_1.z.nativeEnum(RoadmapItemPriority),
    createdAt: zod_1.z.string().datetime({ offset: true }),
    updatedAt: zod_1.z.string().datetime({ offset: true }),
    issueUrl: githubIssueUrlSchema.nullable(),
    pullRequestUrl: githubPullRequestUrlSchema.nullable(),
})
    .strict();
exports.RoadmapQuerySchema = zod_1.z
    .object({
    page: zod_1.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
    pageSize: zod_1.z
        .number()
        .int()
        .min(1)
        .max(exports.ROADMAP_DEFAULT_PAGE_SIZE)
        .optional(),
})
    .strict();
exports.RoadmapPaginationSchema = zod_1.z
    .object({
    page: zod_1.z.number().int().min(1).max(Number.MAX_SAFE_INTEGER),
    pageSize: zod_1.z.number().int().min(1).max(100),
    totalIssues: zod_1.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
    totalPages: zod_1.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
})
    .strict();
const roadmapCountSchema = zod_1.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
exports.RoadmapFacetsSchema = zod_1.z
    .object({
    statusCounts: zod_1.z
        .object({
        [RoadmapItemStatus.BACKLOG]: roadmapCountSchema,
        [RoadmapItemStatus.BUILDING]: roadmapCountSchema,
        [RoadmapItemStatus.SHIPPED]: roadmapCountSchema,
        [RoadmapItemStatus.CANCELED]: roadmapCountSchema,
    })
        .strict(),
    priorityCounts: zod_1.z
        .object({
        [RoadmapItemPriority.URGENT]: roadmapCountSchema,
        [RoadmapItemPriority.HIGH]: roadmapCountSchema,
        [RoadmapItemPriority.MEDIUM]: roadmapCountSchema,
        [RoadmapItemPriority.LOW]: roadmapCountSchema,
        [RoadmapItemPriority.NO_PRIORITY]: roadmapCountSchema,
    })
        .strict(),
})
    .strict();
exports.RoadmapResponseSchema = zod_1.z
    .object({
    status: zod_1.z.literal('ok'),
    results: zod_1.z.array(exports.RoadmapItemSchema),
    pagination: exports.RoadmapPaginationSchema,
    facets: exports.RoadmapFacetsSchema,
})
    .strict();
//# sourceMappingURL=roadmap.js.map