# C++17 AutoStore Implementation Plan This document outlines the steps to implement the C++17 version of the AutoStore application. Implemented classes should use `nxl::` namespace prefix. ## Phase 1: Project Scaffolding & Build System - [x] Initialize a CMake project structure. - [x] Set up the root `CMakeLists.txt` to manage the `app` and `lib` subdirectories. - [x] Create the `lib` directory for the static library. - [x] Create the `app` directory for the executable. - [x] Configure `vcpkg` for dependency management and integrate it with CMake. - [x] Add a dependency for an HTTP library (e.g., `cpp-httplib`) via `vcpkg`. - [x] Add a dependency for a testing framework (e.g., `catch2`) via `vcpkg`. ## Phase 2: Library (`lib`) - Dummy Implementation - [x] Create the directory structure for the library: `lib/src`, `lib/include`. - [x] Create `lib/CMakeLists.txt` to build a static library. - [x] In `lib/include/autostore`, define the public interface for the `App` to use. - [x] Create a dummy `AutoStore` class in `lib/include/autostore/AutoStore.h` and a source file in `lib/src/AutoStore.cpp`. - [ ] Define initial classes for core domain and application logic inside the library (e.g., `ItemRepository`, `UserService`, etc.) to establish the architecture. These will be mostly private to the library initially and implemented later. - [ ] Ensure the project compiles and links successfully with the dummy implementations. ## Phase 3: Application (`app`) - Dummy Implementation - [ ] Create the directory structure for the application: `app/src`. - [x] Create `app/CMakeLists.txt` to build the executable. - [ ] Link the `app` against the `lib` static library. - [ ] Implement the main `App` class in `app/src/App.h` and `app/src/App.cpp`. - [ ] The `App` class will have a constructor `App(int argc, char** argv)` and an `exec()` method. - [ ] Implement signal handling (for `SIGINT`, `SIGTERM`) in the `App` class for graceful shutdown. - [x] In `app/src/Main.cpp`, instantiate and run the `App` class. - [ ] Ensure the project compiles and links successfully with the dummy implementations. ## Phase 4: Core Logic Implementation - [ ] Implement the Domain layer in `lib/src/domain`. - [ ] Implement the Application layer in `lib/src/application`. - [ ] Implement the Infrastructure layer in `lib/src/infrastructure` (e.g., file-based persistence, HTTP client for ordering). - [ ] Implement the Presentation layer (HTTP API) using the chosen HTTP library. - [ ] Implement the startup logic to check for expired items. - [ ] Implement a background mechanism (e.g., a thread) to periodically check for expired items. ## Phase 5: Testing - [ ] Set up a `tests` directory. - [ ] Create `tests/CMakeLists.txt` to build the test runner. - [ ] Write unit tests for the Domain layer. - [ ] Write unit tests for the Application layer, using mocks for infrastructure interfaces. - [ ] Write integration tests for the Infrastructure layer. ## Phase 6: Containerization - [x] Create a `Dockerfile` to build the C++ application in a container. - [x] Create a `docker-compose.yml` file to easily build and run the application.