//! Recurring templates: E-28 to E-30 (FR-9, SPEC §9.5). //! //! Registered and annotated by M2a; M3 owns this file and implements the handlers (until then 501 //! `not_implemented`). use crate::api::{IdPath, not_implemented}; use crate::auth::AuthDevice; use crate::error::AppError; use crate::openapi::responses::{BadRequest, Conflict, NotFound, Unprocessable}; use crate::wire::{ CreateRecurringTemplateRequest, PatchRecurringTemplateRequest, RecurringTemplate, UuidSchema, }; #[utoipa::path( post, path = "/recurring-templates", operation_id = "createRecurringTemplate", summary = "E-28 Create recurring template", description = "If a period is already due (SPEC §9.5), the server generates it before responding.", request_body(content = CreateRecurringTemplateRequest, content_type = "application/json; charset=utf-8"), responses( (status = 201, description = "The new template.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"), (status = 400, response = BadRequest), (status = 409, response = Conflict), (status = 422, response = Unprocessable), ) )] pub async fn create_recurring_template(_device: AuthDevice) -> AppError { not_implemented() } #[utoipa::path( patch, path = "/recurring-templates/{template_id}", operation_id = "patchRecurringTemplate", summary = "E-29 Edit, pause, resume", description = "Any subset of the E-28 fields; `split_mode` and `splits` must be sent together.", params( ("template_id" = UuidSchema, Path, description = "Not a UUID is 404 `not_found`."), ), request_body(content = PatchRecurringTemplateRequest, content_type = "application/json; charset=utf-8"), responses( (status = 200, description = "The updated template.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"), (status = 400, response = BadRequest), (status = 404, response = NotFound), (status = 422, response = Unprocessable), ) )] pub async fn patch_recurring_template( _device: AuthDevice, IdPath(_template_id): IdPath, ) -> AppError { not_implemented() } #[utoipa::path( delete, path = "/recurring-templates/{template_id}", operation_id = "deleteRecurringTemplate", summary = "E-30 Soft delete recurring template", params( ("template_id" = UuidSchema, Path, description = "Not a UUID is 404 `not_found`."), ), responses( (status = 200, description = "The tombstone.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"), (status = 404, response = NotFound), ) )] pub async fn delete_recurring_template( _device: AuthDevice, IdPath(_template_id): IdPath, ) -> AppError { not_implemented() }