openapi: 3.0.1 info: title: ToolRentalApi description: An API to facilitate the rental of tools termsOfService: '' license: name: '' url: http://unlicense.org version: '1.0' servers: - url: http://localhost:3000 description: Generated server url paths: /api/v1/tool/{code}/checkout: post: tags: - Tool summary: Create a rental agreement operationId: postApiV1ToolCodeCheckout parameters: - name: code in: path required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/RentalRequest' required: true responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RentalAgreement' /api/v1/tool/{code}: get: tags: - Tool summary: Get pricing details operationId: getApiV1ToolCode parameters: - name: code in: path required: true schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ToolPricingDetails' /api/v1/tool/rentalAgreement: get: tags: - RentalAgreement summary: Get all rental agreements operationId: getAllRentalAgreements responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/RentalAgreement' /api/v1/tool: get: tags: - Tool summary: Get tools available for rent operationId: getApiV1Tool responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Tool' components: schemas: RentalRequest: required: - checkout_date - rental_days_count - tool_code type: object properties: tool_code: type: string readOnly: true rental_days_count: type: integer format: int32 discount_percent: maximum: 100 minimum: 0 type: integer format: int32 checkout_date: type: string RentalAgreement: required: - checkout_date - tool_code type: object properties: tool_code: type: string tool_type: type: string tool_brand: type: string rental_days: type: string checkout_date: type: string due_date: type: string daily_charge: type: number charge_days: type: number pre_discount_charge: type: number discount_percent: type: string discount_amount: type: number final_charge: type: number ToolPricingDetails: required: - code - daily_charge - holiday_charge - weekend_charge type: object properties: code: type: string description: Unique identifier for a tool instance daily_charge: type: number description: Daily Charge of the tool weekend_charge: type: boolean description: Is the tool chargable on weekends? holiday_charge: type: boolean description: Is the tool chargeable on observed holidays? description: Rental price details about each tool available for rent Tool: required: - brand - code - type type: object properties: code: type: string description: Unique identifier for a tool instance type: type: string description: The type of tool. brand: type: string description: Tools available for rent