# io8 Business Analyst Agent - Customized for This Project

## Project-Specific Instructions

```
.sureai/.io8analyst_agent_ecom_app_ecom_app_20251015_121220.md
# io8Analyst Agent Instructions for E-commerce Application ("ecom app")

## Project Context

This project involves developing a fully functional e-commerce platform. The frontend will leverage an existing `cloned base project`, which is an Angular Clarity boilerplate. The core task for `io8analyst` is to define comprehensive business, functional, and non-functional requirements that integrate with this base project while enabling a robust e-commerce experience.

**Reference Documents:**
- `io8codermaster_breakdown.md` (specifically the "E-commerce Application Project Breakdown" section)
- `io8codermaster_plan.md` (specifically the "E-commerce Application Implementation Plan" section)

## Analysis Methodology for E-commerce Application

1.  **Iterative Requirements Elicitation:** Start with high-level goals from `io8codermaster_breakdown.md` and `io8codermaster_plan.md` (e.g., product browsing, shopping cart, user account, secure checkout), then progressively drill down into detailed functional and non-functional requirements.
2.  **User-Centric Approach:** Prioritize user flows and experiences (e.g., product browsing, adding to cart, checkout, user registration) to ensure the application is intuitive and effective. Consider both shopper and administrator personas.
3.  **Base Project Integration Analysis:** Explicitly analyze how new e-commerce features will integrate with the existing Angular Clarity boilerplate. Identify potential adaptations or extensions needed for the UI framework, layout, and overall project structure to maintain consistency.
4.  **Security and Performance Focus:** Given this is an e-commerce application, rigorously define security (data protection, payment security, authentication) and performance (page load times, API response) requirements as critical non-functional aspects.
5.  **Scalability Considerations:** Ensure requirements allow for future expansion of product catalogs, user base, and transaction volume without requiring a complete architectural overhaul.

## Requirements Analysis Approach

1.  **Decomposition of High-Level Goals:** Break down the overall "ecom app" goal into major functional areas as outlined in the `io8codermaster_breakdown.md` (e.g., Product Management, User Management, Shopping Cart, Checkout, Payment).
2.  **Detailed Functional Requirements:** For each functional area, define specific, unambiguous, measurable, and testable requirements (FR-xxx). Ensure clarity on what the system *shall* do.
3.  **Non-Functional Requirements (NFRs):** Address NFRs covering performance, security, usability, scalability, maintainability, and compatibility with the existing Angular Clarity base project. These should also be specific and measurable (NFR-xxx).
4.  **Interface Requirements:** Detail requirements for user interface elements, navigation, and API interactions. Specifically consider how the Clarity Design System will be utilized and extended for e-commerce specific UI components.
5.  **Data Requirements:** Identify key entities (e.g., Product, User, Order, Cart Item, Category, Address, PaymentTransaction) and their essential attributes, outlining relationships between them. Extend the basic `User` and `Product` models from the boilerplate breakdown.

## Business Analysis Framework

1.  **Project Objectives Alignment:** Ensure all requirements directly contribute to the project's high-level goal of delivering a functional e-commerce platform, as defined in `io8codermaster_breakdown.md` and `io8codermaster_plan.md`.
2.  **Stakeholder Identification (Implicit):** Consider the needs of primary stakeholders: end-users (shoppers), administrators (product managers, order processors), and the development team (maintainability, scalability, ease of integration).
3.  **Scope Definition:** Clearly delineate the scope for the Minimum Viable Product (MVP) based on the core e-commerce features mentioned in the `io8codermaster_breakdown.md` (e.g., product listing, search, add to cart, checkout, user accounts, basic admin for products). Defer complex features like recommendations or advanced promotions to future phases.
4.  **Constraint Integration:** Incorporate constraints from the `io8codermaster_breakdown.md` (Base Project Integration, Security & Compliance, Performance Targets, Maintainability, Scalability, Payment Gateway selection) directly into specific functional and non-functional requirements.

## User Story Development Strategy

1.  **Persona-Based Stories:** Frame user stories from the perspective of key personas. For this e-commerce project, primary personas include "As a Shopper..." and "As an Administrator...".
2.  **Feature-Driven Stories:** Create user stories for each core e-commerce feature identified in the requirements analysis (e.g., "As a shopper, I want to browse products by category...", "As an administrator, I want to add new products...").
3.  **Acceptance Criteria (Gherkin Format):** Each user story must include clear, concise, and testable acceptance criteria using the "Given-When-Then" format to ensure unambiguous understanding and facilitate testing.
4.  **Prioritization (Implicit):** While explicit prioritization is for the `io8pm` and `io8sm`, structure user stories by functional area, with core e-commerce functionalities naturally grouped as high priority.

## Customized io8Analyst Workflow for E-commerce Application

1.  **Initial Document Review:** Thoroughly read and extract key information from `io8codermaster_breakdown.md` and `io8codermaster_plan.md` to understand the overall project scope, constraints, and the role of the existing Angular Clarity base project. Pay close attention to the "E-commerce Application Project Breakdown" and "Implementation Plan" sections.
2.  **E-commerce Core Feature Identification:** List all essential e-commerce functionalities required for an MVP based on the provided breakdown. This includes, but is not limited to: Product Display, Product Search/Filtering, Shopping Cart, User Registration/Login, User Profile Management, Checkout Flow, Payment Integration, Order Confirmation, and basic Administrator Product Management.
3.  **Analysis Document Creation/Update (`.sureai/analysis_document.md`):**
    *   **Project Overview:** Populate this section using the high-level goal from the `io8codermaster_breakdown.md`.
    *   **Business Analysis:** Detail the business context for an e-commerce application, target users, and the value proposition, inferring from the project's nature.
    *   **User Requirements:** Extract and elaborate on specific user needs and capabilities from the `io8codermaster_breakdown.md` milestones.
    *   **Functional Requirements:** Systematically break down the core e-commerce features into detailed descriptions.
    *   **Non-Functional Requirements:** Define NFRs with a strong emphasis on security, performance, scalability, usability, and maintainability, tailored for an e-commerce platform and the base project.
    *   **User Stories:** Develop concrete user stories for both shoppers and administrators, including acceptance criteria.
    *   **Business Rules:** Outline key operational rules governing inventory, pricing, orders, and payment processing.
4.  **Requirements Document Creation/Update (`.sureai/requirements_document.md`):**
    *   **Functional Requirements (FR-xxx):** Translate the functional requirements from the analysis document into formal, numbered FRs with clear descriptions, acceptance criteria, and priority.
    *   **Non-Functional Requirements (NFR-xxx):** Translate NFRs into formal, numbered NFRs with specific, measurable acceptance criteria.
    *   **User Stories:** List all generated user stories with their acceptance criteria.
    *   **Data Requirements:** Detail the proposed data models, including entities, their attributes, and relationships, extending the basic models provided in the boilerplate.
    *   **Interface Requirements:** Define explicit requirements for the UI (adherence to Clarity Design System, responsiveness, navigation) and the API (RESTful, JSON, authentication, error handling).
5.  **Traceability:** Ensure every requirement documented in both `analysis_document.md` and `requirements_document.md` can be traced back to the initial project breakdown and high-level user goals specified in `io8codermaster_breakdown.md`.
6.  **Append-Only Mode:** Strictly adhere to appending new content to the existing `.sureai/analysis_document.md` and `.sureai/requirements_document.md` files. Do not overwrite existing content, and use clear section headers and timestamps for new additions.
7.  **Timestamping:** Include precise timestamps (`YYYY-MM-DDTHH:MM:SS.microseconds`) for all new sections to maintain chronological order and traceability.

## Critical Focus Areas for this Project

*   **Integration with Angular Clarity Boilerplate:** Clearly define how new e-commerce components (e.g., product cards, checkout steps, admin dashboards) will be implemented using or extending Clarity components and integrated into the boilerplate's existing layout and navigation.
*   **Secure Payment Gateway Integration:** Requirements must cover secure handling of payment information, data tokenization, and explicit adherence to PCI DSS considerations for any touchpoints within the application, even if a third-party gateway handles the bulk of compliance.
*   **Scalable Product Catalog:** Requirements should consider varying product attributes, categories, and potential product variations, ensuring the design can handle a large and growing catalog efficiently.
*   **User Authentication & Authorization:** Defining robust and secure processes for user registration, login, session management, and differentiating access rights between shoppers and administrators.
*   **Order Management:** Comprehensive requirements for the entire order lifecycle, from creation and payment to status updates and history.
```
{
  "analysis": "---\n## Project Overview\nGenerated: 2025-10-15T12:12:20.153210\n\nThe project aims to develop a fully functional E-commerce Application (referred to as \"ecom app\"). The core objective is to provide a platform enabling product browsing, robust shopping cart functionality, comprehensive user account management, and a secure, streamlined checkout process. The project will leverage an existing Angular Clarity boilerplate as its frontend foundation, extending and integrating e-commerce specific features into this established structure.\n\n## Business Analysis\nGenerated: 2025-10-15T12:12:20.153210\n\nThe \"ecom app\" targets online consumers seeking to purchase products, and administrators responsible for managing the product catalog and processing orders. The business value lies in creating a user-friendly, secure, and performant online retail experience. Key considerations include:\n-   **Market Need:** Fulfill the demand for convenient online shopping.\n-   **Value Proposition:** Offer a reliable and intuitive platform for product discovery and purchase.\n-   **Operational Efficiency:** Provide tools for administrators to easily manage products, inventory, and orders.\n-   **Competitive Advantage:** Potentially differentiate through specific product offerings, user experience, or service.\n-   **Monetization:** Direct sales of products via the platform.\n\n## User Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\nBased on the `io8codermaster_breakdown.md` for \"ecom app\", the primary user requirements include:\n\n1.  **Product Discovery:** Users need to be able to browse a product catalog, search for specific products, and view detailed product information.\n2.  **Shopping Cart Management:** Users must be able to add products to a shopping cart, modify quantities, and remove items before checkout.\n3.  **User Account Management:** Users require functionality to register, log in, manage their profile details, and view their order history.\n4.  **Secure Checkout:** Users need a secure and intuitive process to provide shipping information, select payment methods, and finalize their purchases.\n5.  **Order Tracking:** Users should be able to view the status of their placed orders.\n6.  **Administrator Product Management:** Administrators need CRUD (Create, Read, Update, Delete) capabilities for products, including managing inventory and categories.\n7.  **Administrator Order Processing:** Administrators need to view and manage customer orders.\n\n## Functional Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\nThe \"ecom app\" will include the following core functional areas:\n\n### 1. Product Catalog Management\n-   Display a list of available products.\n-   Allow users to search and filter products by various criteria (e.g., category, price range).\n-   Provide detailed product pages with images, descriptions, specifications, and pricing.\n-   Support product categories for organization.\n-   Enable administrators to add, edit, and delete products, including managing inventory levels.\n\n### 2. User Authentication & Profile\n-   User registration and login functionality.\n-   Password recovery (forgot password).\n-   User profile management (update personal details, shipping addresses).\n-   View past order history for authenticated users.\n\n### 3. Shopping Cart & Order Processing\n-   Add products to a persistent shopping cart.\n-   Update product quantities in the cart.\n-   Remove products from the cart.\n-   Calculate subtotal, taxes, and shipping costs in the cart.\n-   Initiate and complete a secure checkout process.\n-   Generate order confirmations and unique order IDs.\n\n### 4. Checkout Flow\n-   Collect shipping address information.\n-   Allow selection of shipping methods.\n-   Integrate with a payment gateway for secure transaction processing.\n-   Display order summary before final confirmation.\n\n### 5. Payment Integration\n-   Process credit card or other supported payment methods securely.\n-   Handle payment success and failure notifications.\n\n## Non-Functional Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\n### 1. Performance\n-   Page load times for product listings and detail pages shall not exceed 3 seconds under normal load.\n-   API response times for critical operations (e.g., search, add to cart, checkout) shall be under 500ms.\n-   The application shall support a minimum of [X] concurrent users without significant degradation in performance.\n\n### 2. Security\n-   All sensitive user data (passwords, payment information) shall be encrypted both in transit (HTTPS/SSL) and at rest.\n-   User authentication shall implement industry-standard practices (e.g., hashed passwords, secure session management, brute-force protection).\n-   Payment gateway integration shall adhere to PCI DSS compliance standards where applicable.\n-   Protection against common web vulnerabilities (e.g., XSS, CSRF, SQL Injection) shall be implemented.\n-   Role-based access control (RBAC) shall be enforced for administrator functionalities.\n\n### 3. Scalability\n-   The system architecture shall be capable of scaling horizontally to accommodate increased user traffic and a growing product catalog.\n-   The database design shall support efficient querying for large datasets (products, orders, users).\n\n### 4. Usability\n-   The user interface shall be intuitive and easy to navigate, consistent with the Clarity Design System.\n-   The application shall be fully responsive, providing an optimal experience across various devices (desktop, tablet, mobile).\n-   Clear feedback mechanisms shall be provided for user actions (e.g., item added to cart, order placed successfully).\n\n### 5. Maintainability\n-   The codebase shall be modular, well-documented, and adhere to established coding standards.\n-   New features and bug fixes should be implementable with minimal impact on existing functionalities.\n\n### 6. Integration with Base Project\n-   New e-commerce specific UI components shall seamlessly integrate with the Angular Clarity boilerplate's styling and structure.\n-   The existing core/shared module structure of the base project shall be extended for e-commerce features.\n\n## User Stories\nGenerated: 2025-10-15T12:12:20.153210\n\n### As a Shopper:\n\n-   **User Story:** As a shopper, I want to browse products by category so I can easily find items of interest.\n    -   **Acceptance Criteria:**\n        -   Given I am on the homepage, When I select a category from the navigation, Then I see a list of products belonging to that category.\n        -   Given I am on a category page, When I apply a filter, Then the displayed products are updated according to the filter.\n-   **User Story:** As a shopper, I want to search for products by keywords so I can quickly locate specific items.\n    -   **Acceptance Criteria:**\n        -   Given I am on any page, When I enter a keyword into the search bar and submit, Then I see a list of products matching the keyword.\n-   **User Story:** As a shopper, I want to view detailed product information so I can make an informed purchasing decision.\n    -   **Acceptance Criteria:**\n        -   Given I am on a product listing, When I click on a product, Then I am taken to a product detail page showing images, description, price, and availability.\n-   **User Story:** As a shopper, I want to add products to my shopping cart so I can purchase multiple items.\n    -   **Acceptance Criteria:**\n        -   Given I am on a product detail page, When I click \"Add to Cart\", Then the product is added to my cart and the cart icon updates with the new item count.\n-   **User Story:** As a shopper, I want to adjust the quantity of items in my cart so I can buy more or fewer of a specific product.\n    -   **Acceptance Criteria:**\n        -   Given I am viewing my shopping cart, When I change the quantity of an item, Then the total price of the cart updates automatically.\n-   **User Story:** As a shopper, I want to proceed to checkout so I can finalize my purchase.\n    -   **Acceptance Criteria:**\n        -   Given I have items in my cart, When I click \"Proceed to Checkout\", Then I am directed to the first step of the checkout process.\n-   **User Story:** As a shopper, I want to provide my shipping address during checkout so my order can be delivered correctly.\n    -   **Acceptance Criteria:**\n        -   Given I am in the checkout process, When I enter and confirm my shipping address, Then I can proceed to the next step.\n-   **User Story:** As a shopper, I want to pay for my order securely so my financial information is protected.\n    -   **Acceptance Criteria:**\n        -   Given I am at the payment step of checkout, When I enter my payment details and submit, Then the payment is processed securely via the integrated gateway.\n-   **User Story:** As a shopper, I want to receive an order confirmation so I know my purchase was successful.\n    -   **Acceptance Criteria:**\n        -   Given my payment is successful, When the order is placed, Then I see an order confirmation page with my order number and receive an email confirmation.\n-   **User Story:** As a shopper, I want to register for an account so I can track my orders and save my details.\n    -   **Acceptance Criteria:**\n        -   Given I am on the login/registration page, When I provide my email and password and submit, Then my account is created and I am logged in.\n-   **User Story:** As a shopper, I want to log in to my existing account so I can access my profile and order history.\n    -   **Acceptance Criteria:**\n        -   Given I am on the login page, When I enter my credentials and submit, Then I am logged in and directed to my dashboard or homepage.\n-   **User Story:** As a shopper, I want to view my past orders so I can keep track of my purchase history.\n    -   **Acceptance Criteria:**\n        -   Given I am logged in, When I navigate to \"My Orders\", Then I see a list of all my previous purchases with their status.\n\n### As an Administrator:\n\n-   **User Story:** As an administrator, I want to add new products to the catalog so they can be available for sale.\n    -   **Acceptance Criteria:**\n        -   Given I am logged into the admin panel, When I fill out the product details form and submit, Then the new product appears in the product listing.\n-   **User Story:** As an administrator, I want to update product details (e.g., price, description, inventory) so product information is always current.\n    -   **Acceptance Criteria:**\n        -   Given I am viewing a product in the admin panel, When I edit its details and save, Then the product information is updated in the catalog.\n-   **User Story:** As an administrator, I want to manage product categories so products can be organized effectively.\n    -   **Acceptance Criteria:**\n        -   Given I am in the admin panel, When I create, edit, or delete a category, Then the category structure is updated for product assignment.\n\n## Business Rules\nGenerated: 2025-10-15T12:12:20.153210\n\n1.  **Inventory Management:** A product cannot be added to the cart or purchased if its `stockQuantity` is zero or less. The `stockQuantity` must be decremented upon successful order placement and incremented upon order cancellation/return.\n2.  **Pricing:** All product prices must be positive numbers. Promotions or discounts will be applied before tax calculation.\n3.  **Order Placement:** An order can only be placed after a successful payment transaction.\n4.  **User Authentication:** Users must be authenticated to perform actions such as placing an order, viewing their order history, or updating their profile.\n5.  **Payment Processing:** Payments will be processed through a third-party gateway, and the application will only store references/tokens, not raw payment details (e.g., credit card numbers).\n6.  **Shipping:** Shipping costs will be calculated based on predefined rules (e.g., flat rate, by weight, by region).\n7.  **Data Validation:** All user inputs (e.g., registration forms, checkout forms) must be validated server-side and client-side to ensure data integrity and security.\n",
  "requirements": "---\n## Functional Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\n### FR-001: Product Listing and Search\n-   **Description:** The system shall display a list of products and allow users to search and filter products.\n-   **Acceptance Criteria:**\n    -   The system shall display products with at least an image, name, and price.\n    -   The system shall provide a search bar to find products by keywords.\n    -   The system shall allow filtering by product categories.\n    -   The system shall display search results and filters in a responsive layout using Clarity Design System components (e.g., Datagrid for admin, card layout for users).\n-   **Priority:** High\n\n### FR-002: Product Detail Page\n-   **Description:** The system shall provide detailed information for individual products.\n-   **Acceptance Criteria:**\n    -   Each product shall have a dedicated page displaying multiple images, a full description, specifications, and the current price.\n    -   The page shall indicate product availability (in stock/out of stock).\n    -   The page shall include an \"Add to Cart\" button.\n-   **Priority:** High\n\n### FR-003: Shopping Cart Management\n-   **Description:** The system shall allow users to add, update, and remove products from a shopping cart.\n-   **Acceptance Criteria:**\n    -   Users shall be able to add a product from its detail page to the cart.\n    -   Users shall be able to view all items currently in their cart.\n    -   Users shall be able to change the quantity of any item in the cart.\n    -   Users shall be able to remove any item from the cart.\n    -   The cart shall display the subtotal and estimated total (before shipping/taxes if applicable).\n    -   The cart state shall persist for authenticated users across sessions.\n-   **Priority:** High\n\n### FR-004: User Authentication and Authorization\n-   **Description:** The system shall provide secure user registration, login, and access control.\n-   **Acceptance Criteria:**\n    -   Users shall be able to register a new account with a unique email and password.\n    -   Users shall be able to log in with their registered credentials.\n    -   Users shall be able to reset their password via a secure process.\n    -   The system shall differentiate between 'Shopper' and 'Administrator' roles, restricting access to admin features.\n-   **Priority:** High\n\n### FR-005: User Profile Management\n-   **Description:** Authenticated users shall be able to manage their personal information and view order history.\n-   **Acceptance Criteria:**\n    -   Users shall be able to update their name, email, and shipping addresses.\n    -   Users shall be able to view a list of all their past orders, including order status and details.\n-   **Priority:** Medium\n\n### FR-006: Checkout Process\n-   **Description:** The system shall guide users through a multi-step checkout process.\n-   **Acceptance Criteria:**\n    -   The checkout process shall include steps for shipping address, shipping method (if applicable), and payment.\n    -   Users shall be able to review their order summary before final confirmation.\n    -   The system shall validate all required information at each step before proceeding.\n-   **Priority:** High\n\n### FR-007: Payment Gateway Integration\n-   **Description:** The system shall securely process payments via an integrated third-party payment gateway.\n-   **Acceptance Criteria:**\n    -   The system shall integrate with [e.g., Stripe, PayPal] for payment processing.\n    -   The system shall securely transmit payment details to the gateway, without storing sensitive information on its own servers.\n    -   The system shall handle successful and failed payment responses from the gateway.\n    -   Upon successful payment, an order shall be created and stored.\n-   **Priority:** High\n\n### FR-008: Order Confirmation and History\n-   **Description:** The system shall confirm successful orders and provide users access to their order history.\n-   **Acceptance Criteria:**\n    -   Upon successful checkout, the system shall display an order confirmation page with a unique order number.\n    -   The system shall send an order confirmation email to the user.\n    -   Authenticated users shall be able to view their complete order history from their profile.\n-   **Priority:** High\n\n### FR-009: Administrator Product Management\n-   **Description:** Administrators shall have tools to manage the product catalog.\n-   **Acceptance Criteria:**\n    -   Administrators shall be able to create new products with details (name, description, price, images, category, inventory).\n    -   Administrators shall be able to edit existing product details and update inventory levels.\n    -   Administrators shall be able to delete products.\n    -   Administrators shall be able to create, edit, and delete product categories.\n-   **Priority:** High\n\n## Non-Functional Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\n### NFR-001: Performance\n-   **Description:** The application must deliver a fast and responsive user experience.\n-   **Acceptance Criteria:**\n    -   **Page Load Time:** All primary pages (homepage, product listings, product detail, cart) shall load within 3 seconds for 90% of users on a broadband connection.\n    -   **API Response Time:** Critical API endpoints (e.g., product search, add to cart, checkout submission) shall respond within 500 milliseconds for 95% of requests.\n    -   **Concurrency:** The system shall support at least 100 concurrent active users without noticeable performance degradation.\n\n### NFR-002: Security\n-   **Description:** The application must protect user data, transactions, and system integrity.\n-   **Acceptance Criteria:**\n    -   **Data Encryption:** All data transmitted between client and server shall use HTTPS/SSL. Sensitive data at rest (e.g., passwords) shall be encrypted.\n    -   **Authentication:** Passwords shall be securely hashed and salted. Failed login attempts shall be rate-limited.\n    -   **Authorization:** Role-based access control shall strictly limit access to administrative functions.\n    -   **Payment Security:** Integration with payment gateways shall adhere to their specified security protocols and, if applicable, PCI DSS compliance standards. No raw payment card data shall be stored on the application's servers.\n    -   **Vulnerability Protection:** The application shall be hardened against common OWASP Top 10 vulnerabilities (e.g., SQL Injection, XSS, CSRF).\n\n### NFR-003: Scalability\n-   **Description:** The system must be able to handle growth in user base, product catalog, and transaction volume.\n-   **Acceptance Criteria:**\n    -   The backend API shall support horizontal scaling by adding more instances.\n    -   The database design shall be optimized for large datasets and high read/write loads.\n    -   The application architecture shall allow for future microservices decomposition if required.\n\n### NFR-004: Usability\n-   **Description:** The application shall be easy to use and navigate for all users.\n-   **Acceptance Criteria:**\n    -   **Consistency:** The UI/UX shall be consistent with the Clarity Design System provided by the `cloned base project`.\n    -   **Responsiveness:** The frontend shall be fully responsive and optimized for desktop, tablet, and mobile browsers.\n    -   **Feedback:** Users shall receive clear and timely feedback for all actions (e.g., successful additions to cart, form submission errors).\n\n### NFR-005: Maintainability\n-   **Description:** The codebase shall be easy to understand, modify, and extend.\n-   **Acceptance Criteria:**\n    -   The codebase shall adhere to established coding standards and best practices (e.g., Angular style guide, backend framework guidelines).\n    -   Key components and services shall be well-documented both internally (code comments) and externally (design documents).\n    -   New features shall be implementable with minimal impact on existing functionality through modular design.\n\n### NFR-006: Compatibility\n-   **Description:** The application must integrate seamlessly with the existing Angular Clarity boilerplate.\n-   **Acceptance Criteria:**\n    -   New frontend components shall utilize or extend existing Clarity components and styling.\n    -   The e-commerce specific routing and navigation shall integrate with the boilerplate's existing navigation structure.\n\n## Data Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\n### Entities and Attributes:\n\n-   **User:**\n    -   `id` (PK, UUID)\n    -   `username` (string, unique)\n    -   `email` (string, unique)\n    -   `passwordHash` (string)\n    -   `firstName` (string)\n    -   `lastName` (string)\n    -   `role` (enum: 'Shopper', 'Admin')\n    -   `createdAt` (timestamp)\n    -   `updatedAt` (timestamp)\n\n-   **Address:**\n    -   `id` (PK, UUID)\n    -   `userId` (FK to User.id)\n    -   `addressLine1` (string)\n    -   `addressLine2` (string, nullable)\n    -   `city` (string)\n    -   `stateProvince` (string)\n    -   `postalCode` (string)\n    -   `country` (string)\n    -   `isDefaultShipping` (boolean)\n    -   `isDefaultBilling` (boolean)\n\n-   **Category:**\n    -   `id` (PK, UUID)\n    -   `name` (string, unique)\n    -   `description` (string, nullable)\n    -   `parentCategoryId` (FK to Category.id, nullable for top-level categories)\n\n-   **Product:**\n    -   `id` (PK, UUID)\n    -   `name` (string)\n    -   `description` (text)\n    -   `price` (decimal, > 0)\n    -   `sku` (string, unique)\n    -   `stockQuantity` (integer, >= 0)\n    -   `imageURLs` (array of strings, nullable)\n    -   `categoryId` (FK to Category.id)\n    -   `createdAt` (timestamp)\n    -   `updatedAt` (timestamp)\n\n-   **Cart:**\n    -   `id` (PK, UUID)\n    -   `userId` (FK to User.id, nullable for guest carts)\n    -   `sessionId` (string, unique, for guest carts)\n    -   `createdAt` (timestamp)\n    -   `updatedAt` (timestamp)\n\n-   **CartItem:**\n    -   `id` (PK, UUID)\n    -   `cartId` (FK to Cart.id)\n    -   `productId` (FK to Product.id)\n    -   `quantity` (integer, > 0)\n    -   `priceAtTimeOfAddition` (decimal)\n\n-   **Order:**\n    -   `id` (PK, UUID)\n    -   `userId` (FK to User.id)\n    -   `orderNumber` (string, unique)\n    -   `orderDate` (timestamp)\n    -   `totalAmount` (decimal)\n    -   `shippingAddressId` (FK to Address.id)\n    -   `billingAddressId` (FK to Address.id)\n    -   `status` (enum: 'Pending', 'Processing', 'Shipped', 'Delivered', 'Cancelled')\n    -   `paymentStatus` (enum: 'Pending', 'Paid', 'Failed', 'Refunded')\n\n-   **OrderItem:**\n    -   `id` (PK, UUID)\n    -   `orderId` (FK to Order.id)\n    -   `productId` (FK to Product.id)\n    -   `quantity` (integer, > 0)\n    -   `unitPrice` (decimal)\n    -   `totalPrice` (decimal)\n\n-   **PaymentTransaction:**\n    -   `id` (PK, UUID)\n    -   `orderId` (FK to Order.id)\n    -   `gatewayTransactionId` (string, unique ID from payment gateway)\n    -   `amount` (decimal)\n    -   `currency` (string, e.g., 'USD')\n    -   `status` (enum: 'Success', 'Failed', 'Pending')\n    -   `paymentMethodType` (string, e.g., 'Credit Card', 'PayPal')\n    -   `transactionDate` (timestamp)\n\n### Relationships:\n-   One `User` can have multiple `Addresses`.\n-   One `Category` can have many `Products`.\n-   One `Product` belongs to one `Category`.\n-   One `User` can have one active `Cart`.\n-   One `Cart` can have many `CartItems`.\n-   One `CartItem` refers to one `Product`.\n-   One `User` can place many `Orders`.\n-   One `Order` contains many `OrderItems`.\n-   One `OrderItem` refers to one `Product`.\n-   One `Order` has one `PaymentTransaction`.\n-   An `Order` references `ShippingAddress` and `BillingAddress` (from `Address` table).\n\n## Interface Requirements\nGenerated: 2025-10-15T12:12:20.153210\n\n### 1. User Interface (UI) - Frontend\n-   **Clarity Design System Adherence:** All new UI components (product cards, checkout forms, admin tables) shall be developed using Clarity Design System components and adhere to its styling guidelines to ensure a consistent user experience with the `cloned base project`.\n-   **Responsive Design:** The UI shall be fully responsive, adapting gracefully to various screen sizes (desktop, tablet, mobile) without loss of functionality or aesthetic integrity.\n-   **Navigation:**\n    -   The main navigation (header and sidebar) shall be extended to include e-commerce specific links (e.g., \"Shop\", \"Categories\", \"My Account\", \"Cart\").\n    -   The sidebar navigation should support collapsible sections for product categories, consistent with Clarity's vertical navigation.\n-   **Product Display:** Product listings should utilize card-based layouts for easy browsing. Product detail pages should be clean, with prominent images and clear call-to-action buttons.\n-   **Forms:** All user input forms (registration, login, checkout, profile update) shall use Clarity form components, include clear labels, input validation, and helpful error messages.\n-   **Feedback:** User actions (e.g., \"Add to Cart\") should trigger visual feedback (e.g., a toast notification using Clarity Alert component, cart item count update).\n\n### 2. API Interface (Backend)\n-   **RESTful API:** The backend shall expose a RESTful API for all e-commerce functionalities (products, users, carts, orders, payments).\n-   **JSON Format:** All API requests and responses shall use JSON format.\n-   **Authentication:** API endpoints requiring user authentication shall be secured using token-based authentication (e.g., JWT).\n-   **Versioning:** The API shall support versioning (e.g., `/api/v1/products`).\n-   **Error Handling:** API responses shall include clear error codes and messages for unsuccessful operations.\n-   **Documentation:** The API endpoints should be documented (e.g., using OpenAPI/Swagger) for easy consumption by the frontend and other services.\n"
}
```

## Base Agent Prompt Reference

This agent is based on the standard io8analyst agent with project-specific customizations above.
Refer to the base io8analyst agent prompt for general principles and workflow instructions.
