Company: Accenture NIT Patna
Difficulty: medium
Problem Description You are building a backend API for a dynamic background color application. The frontend consists of a color box and three buttons (Red, Green, Blue) that interact with this API. Your task is to implement endpoints that provide the UI configuration for these buttons and manage the state of the box's background color. Objectives: Provide an endpoint to return the configuration of the three buttons. The frontend requires specific IDs ( red-button , green-button , blue-button ), text labels (red, green, blue), background colors (red, green, blue), and text colors (white) to render them properly. Provide endpoints to retrieve and update the current background color state of the color box. Ensure the API validates the color inputs during updates to restrict changes only to the allowed colors. Endpoints GET /api/buttons : Retrieves the button UI configurations. GET /api/box/color : Retrieves the current background color of the box. PUT /api/box/color : Updates the backgrou