Your system should support the following.
void onboardCenter(String centerName, List<String> centerTimings, List<String> workoutTypes)
centerName is unique for a center (acts as identifier).centerTimings contains time ranges for the day; each element is a string like "6-9" or "18-21". Time is an integer for the current scope (single day).workoutTypes contains allowed workouts for the center, e.g. "Weights", "Cardio", "Yoga", "Swimming".workoutTypes. boolean addWorkoutSlot(String centerName, String workoutType, int startTime, int endTime, int totalSeats)
startTime and endTime are integers for a day-only scope, e.g. 6 to 7.startTime < endTime and totalSeats > 0.workoutType must be one of the allowed types for that center.true if the slot is created; otherwise return false (invalid center, invalid time, invalid workout type, overlaps, etc.). List<String> viewWorkoutAvailabilityByStartTime(String workoutType, String centerName)
workoutType.centerName is empty or "*", include all centers; otherwise restrict to that center.startTime and then lexicographically in ascending order."centerName|workoutType|startTime|endTime|seatsAvailable" List<String> viewWorkoutAvailabilityBySeatsAvailable(String workoutType, String centerName)
workoutType and centerName.centerName must be provided (cannot be empty or "*").seatsAvailable and then lexicographicaly in ascending order."centerName|workoutType|startTime|endTime|seatsAvailable" String bookSession(String userId, String centerName, String workoutType, int startTime, int endTime)
(centerName, workoutType, startTime, endTime)."BOOKED" on success"NO_SEATS" if slot exists but has 0 seats available"SLOT_NOT_FOUND" if the slot does not exist"ALREADY_BOOKED" if the same user already booked the same slot String cancelSession(String userId, String centerName, String workoutType, int startTime, int endTime)
"CANCELLED" on success"BOOKING_NOT_FOUND" if user has no booking for that slot"SLOT_NOT_FOUND" if the slot does not exist String addToInterestList(String userId, String centerName, String workoutType, int startTime, int endTime)
"INTEREST_ADDED" if user was added"ALREADY_INTERESTED" if user is already in the list"SEATS_AVAILABLE" if slot currently has seats (so interest is not needed)"SLOT_NOT_FOUND" if the slot does not exist List<String> notifyInterestedUsers(String centerName, String workoutType, int startTime, int endTime)
"NOTIFY|<userId>|<centerName>|<workoutType>|<startTime>-<endTime>".Time is an integer for a single day only (e.g. 6 means 6 AM, 18 means 6 PM).centerTimings.size() >= 1 and each timing string is a range "start-end" with start < end.workoutTypes.size() >= 1.totalSeats > 0.centerName and userId as unique identifiers).onboardCenter(centerName = "connaught_place", centerTimings = List.of("6-9", "18-21"), workoutTypes = List.of("weights", "cardio", "yoga", "swimming"))onboardCenter(centerName = "bandra_west", centerTimings = List.of("7-10", "19-22"), workoutTypes = List.of("weights", "cardio", "yoga"))addWorkoutSlot(centerName = "connaught_place", workoutType = "weights", startTime = 6, endTime = 7, totalSeats = 100) → trueaddWorkoutSlot(centerName = "connaught_place", workoutType = "cardio", startTime = 7, endTime = 8, totalSeats = 150) → trueaddWorkoutSlot(centerName = "connaught_place", workoutType = "yoga", startTime = 8, endTime = 9, totalSeats = 200) → trueaddWorkoutSlot(centerName = "bandra_west", workoutType = "weights", startTime = 18, endTime = 19, totalSeats = 100) → falseaddWorkoutSlot(centerName = "bandra_west", workoutType = "swimming", startTime = 19, endTime = 20, totalSeats = 100) → falseaddWorkoutSlot(centerName = "bandra_west", workoutType = "cardio", startTime = 19, endTime = 20, totalSeats = 20) → trueaddWorkoutSlot(centerName = "bandra_west", workoutType = "weights", startTime = 20, endTime = 21, totalSeats = 100) → trueaddWorkoutSlot(centerName = "bandra_west", workoutType = "weights", startTime = 21, endTime = 22, totalSeats = 100) → trueviewWorkoutAvailabilityByStartTime(workoutType = "weights", centerName = "*")"connaught_place|weights|6|7|100""bandra_west|weights|20|21|100""bandra_west|weights|21|22|100"bookSession(userId = "vaibhav", centerName = "connaught_place", workoutType = "weights", startTime = 6, endTime = 7) → "BOOKED"viewWorkoutAvailabilityByStartTime(workoutType = "weights", centerName = "*")"connaught_place|weights|6|7|99""bandra_west|weights|20|21|100""bandra_west|weights|21|22|100"bookSession(userId = "vaibhav", centerName = "connaught_place", workoutType = "weights", startTime = 6, endTime = 7) → "ALREADY_BOOKED"viewWorkoutAvailabilityBySeatsAvailable(workoutType = "weights", centerName = "bandra_west")"bandra_west|weights|20|21|100""bandra_west|weights|21|22|100"addWorkoutSlot(centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19, totalSeats = 1) → truebookSession(userId = "arjun", centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19) → "BOOKED"bookSession(userId = "rohit", centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19) → "NO_SEATS"addToInterestList(userId = "rohit", centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19) → "INTEREST_ADDED"cancelSession(userId = "arjun", centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19) → "CANCELLED"notifyInterestedUsers(centerName = "connaught_place", workoutType = "yoga", startTime = 18, endTime = 19)"NOTIFY|rohit|connaught_place|yoga|18-19"viewWorkoutAvailabilityByStartTime(workoutType = "yoga", centerName = "connaught_place")"connaught_place|yoga|8|9|200""connaught_place|yoga|18|19|1"