# joelsp01/papagayodev-test architecture

> Architecture diagram of the GitHub repository joelsp01/papagayodev-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joelsp01/papagayodev-test
- Repository: https://github.com/joelsp01/papagayodev-test

## Overview

##### Project Type & Purpose
- This is a TypeScript-based application that implements a “Pico y Placa” predictor. Its purpose is to determine whether a car is allowed to circulate based on its license plate’s last digit, the day of the week, and restricted hour intervals.
- The project is structured with a clear emphasis on object-oriented design and includes automated tests using Jest.

##### File Structure
- The project has a clear division between source code (in the src directory) and compiled code (in the dist directory). This shows adherence to best practices in TypeScript projects.
- Three main TypeScript files in src/class (automovil.ts, operacion.ts, verificaciones.ts) indicate the three core classes:
- Automovil: Represents the car’s attributes (plate, date, time).
- Operaciones: Contains the core business logic that uses the car’s information to enforce “Pico y Placa” rules.
- Verificaciones: Handles input validation for date and time.
- Presence of index.ts that likely orchestrates the process by instantiating and coordinating between these classes.
- Separate test folders (both in src/test and dist/test) and a Jest configuration file underline the focus on unit testing.
- Configuration and build files (package.json, tsconfig.json, jest.config.js) indicate the build process and dependency management.

##### Main Components
a. User Input / Data Source (the initiating request or entry point, represented by src/index.ts)
b. Domain Model:
- Automovil: Contains data attributes such as the license plate, date, and time.
c. Business Logic Layer:
- Operaciones: Analyzes the automobile’s data in conjunction with Pico y Placa rules.
d. Validation Layer:
- Verificaciones: Ensures the correctness of input data (valid date and time, etc.).
f. Build & Deployment Components:
- TypeScript compilation (source in src/ → compiled output in dist) and test execution workflows.

##### Relationships & Interactions
- The entry point (index.ts) is where the process begins: It instantiates the Automovil object using provided data.
- The Verificaciones component is called first to validate the input.
- Once values are verified, the Operaciones component applies the business rules to determine if the automobile meets circulation criteria.
- The result then flows back (or to the user) as the final output.

##### Architectural Patterns & Technologies
- Object-Oriented Programming: Each core domain concept is encapsulated in its own class.
- Separation of Concerns: Different responsibilities (data representation, validation, business logic) are clearly separated into individual components.
- Testing: Jest is used for unit testing, ensuring each module functions correctly.
- Compile-Time Structure: The presence of a src-to-dist build pattern via the TypeScript configuration reinforces clean code standards.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Entry Point (index.ts)"]:::entry
    B["Input Validation (Verificaciones)"]:::validation
    C["Data Model (Automóvil)"]:::domain
    D["Business Logic (Operaciones)"]:::logic
    E["Output/Result"]:::output
    F["Testing (Jest)"]:::testing

    subgraph "Build & Deployment"
        G1["tsconfig.json"]:::buildConfig
        G2["package.json"]:::buildConfig
        G3["Compiled Code (dist/)"]:::buildConfig
    end

    A -->|"calls"| B
    A -->|"instantiates"| C
    B -->|"validatedData"| C
    C -->|"passesData"| D
    D -->|"returnsResult"| E

    A --- F
    F --- D

    E -->|"compiledTo"| G3
    G1 --> G3
    G2 --> G3

    click A "https://github.com/joelsp01/papagayodev-test/blob/main/src/index.ts"
    click B "https://github.com/joelsp01/papagayodev-test/blob/main/src/class/verificaciones.ts"
    click C "https://github.com/joelsp01/papagayodev-test/blob/main/src/class/automovil.ts"
    click D "https://github.com/joelsp01/papagayodev-test/blob/main/src/class/operacion.ts"
    click F "https://github.com/joelsp01/papagayodev-test/blob/main/src/test/operaciones.test.ts"
    click G1 "https://github.com/joelsp01/papagayodev-test/blob/main/tsconfig.json"
    click G2 "https://github.com/joelsp01/papagayodev-test/blob/main/package.json"
    click G3 "https://github.com/joelsp01/papagayodev-test/tree/main/dist/"

    classDef entry fill:#f9c74f,stroke:#000,stroke-width:2px;
    classDef validation fill:#90be6d,stroke:#000,stroke-width:2px;
    classDef domain fill:#f94144,stroke:#000,stroke-width:2px;
    classDef logic fill:#577590,stroke:#000,stroke-width:2px;
    classDef output fill:#277da1,stroke:#000,stroke-width:2px;
    classDef testing fill:#f8961e,stroke:#000,stroke-width:2px;
    classDef buildConfig fill:#43aa8b,stroke:#000,stroke-width:2px;
```
