import type { OpenAPIV3_1 } from "openapi-types";

export const cronerStatusChange: OpenAPIV3_1.PathsObject = {
	"/api/utils/croner/{status}": {
		patch: {
			summary: "Pauses or Resume the Job",
			description:
				"When sending start or stop with job name it will resume or stop the job",
			tags: ["Utils"],

			parameters: [
				{
					name: "status",
					in: "path",
					required: true,
					description: "Status change",
					schema: {
						type: "string",
					},
					example: "start",
				},
				{
					name: "limit",
					in: "query",
					required: false, // 👈 optional
					description: "Maximum number of records to return",
					schema: {
						type: "integer",
						minimum: 1,
						maximum: 100,
					},
					example: 10,
				},
			],
			requestBody: {
				required: true,
				content: {
					"application/json": {
						schema: {
							type: "object",
							required: ["name"],
							properties: {
								name: {
									type: "string",
									example: "start",
								},
							},
						},
					},
				},
			},

			responses: {
				"200": {
					description: "Successful response",
					content: {
						"application/json": {
							schema: {
								type: "object",
								properties: {
									success: { type: "boolean", example: true },
									data: {
										type: "object",
										example: {
											name: "exampleName",
											value: "some value",
										},
									},
								},
							},
						},
					},
				},
				"400": {
					description: "Bad request",
					content: {
						"application/json": {
							schema: {
								type: "object",
								properties: {
									success: { type: "boolean", example: false },
									message: {
										type: "string",
										example: "Invalid name parameter",
									},
								},
							},
						},
					},
				},
			},
		},
	},
};
