{"openapi":"3.0.3","info":{"title":"AIShift / KUROI Client API","version":"1.1.13","description":"Client API documentation migrated from Google Sheet\n(AIShift Đặc tả API KUROI v1.1.13) — RIZ2-1461.\n\nBase path: `/api/v2/client`\n\nAuthentication: obtain JWT via `POST /auth`, then send\n`Authorization: Bearer {token}` on subsequent requests.\n"},"servers":[{"url":"/api/v2/client","description":"Client API V2"}],"paths":{"/auth":{"post":{"summary":"API 01 — Get access token","description":"Phát hành JWT từ client_id và client_secret.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthRequest"}}}},"responses":{"200":{"description":"Token issued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/available-slots":{"get":{"summary":"API 11 — Get dynamic available slots","parameters":[{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"section_ids","in":"query","schema":{"type":"string"},"description":"Comma-separated section UUIDs"},{"name":"birthday","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Dynamic available slots grouped by section","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/booking-attributes":{"get":{"summary":"API 14 — Get booking attribute definitions (V2)","responses":{"200":{"description":"Booking attribute definitions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Attribute"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/bookings":{"post":{"summary":"API 03 — Create booking","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCreateRequest"}}}},"responses":{"200":{"description":"Booking created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"get":{"summary":"API 09 — Get booking list","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/Limit"},{"name":"booking_date_from","in":"query","schema":{"type":"string","format":"date"}},{"name":"booking_date_to","in":"query","schema":{"type":"string","format":"date"}},{"name":"status","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Paginated bookings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingListResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/bookings/{bookingId}/cancel":{"delete":{"summary":"API 05 — Cancel booking","parameters":[{"name":"bookingId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Booking canceled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/bookings/{id}":{"put":{"summary":"API 04 — Update booking","parameters":[{"$ref":"#/components/parameters/BookingId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingUpdateRequest"}}}},"responses":{"200":{"description":"Booking updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"get":{"summary":"API 08 — Get booking detail","parameters":[{"$ref":"#/components/parameters/BookingId"}],"responses":{"200":{"description":"Booking detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/categories":{"get":{"summary":"API 07 — Get categories","responses":{"200":{"description":"Category tree","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/attributes":{"get":{"summary":"API 10 — Get customer attributes","description":"API 10 — Get List Attributes","responses":{"200":{"description":"Attribute definitions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Attribute"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/course_price":{"get":{"summary":"API 13 — Get course price","parameters":[{"name":"course_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Course price","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/courses":{"get":{"summary":"API 15 — Get courses (V2)","responses":{"200":{"description":"Course list","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/sections":{"get":{"summary":"API 06 — Get section list","description":"Lấy danh sách section (room) của client.","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/Limit"},{"name":"name","in":"query","schema":{"type":"string"},"description":"Filter by section name"},{"name":"status","in":"query","schema":{"type":"integer"},"description":"1: public, 0: private"}],"responses":{"200":{"description":"Paginated section list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SectionListResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/sections/{roomId}/available-slots":{"get":{"summary":"API 02 — Get available slots for a section","parameters":[{"$ref":"#/components/parameters/RoomId"},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Booking date (Y-m-d)"},{"name":"birthday","in":"query","schema":{"type":"string","format":"date"},"description":"Customer birthday for restriction filter"}],"responses":{"200":{"description":"Available slot list","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AvailableSlot"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/store_info":{"get":{"summary":"API 12 — Get school / store info","responses":{"200":{"description":"Store information","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"Page":{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},"Limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"default":15}},"RoomId":{"name":"roomId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Section (room) ID"},"BookingId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"BadRequest":{"description":"Validation or business rule error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"schemas":{"AuthRequest":{"type":"object","required":["client_id","client_secret"],"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string"}}},"AuthResponse":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","example":"bearer"},"expires_in":{"type":"integer","description":"Token TTL in minutes"}}},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"error_code":{"type":"string"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"DayPeriod":{"type":"object","description":"Flexible section time band (section_type = 2)","properties":{"id":{"type":"string","format":"uuid","description":"時間帯ID"},"from":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"開始時刻 (HH:mm)","example":"09:00"},"to":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$","description":"終了時刻 (HH:mm)","example":"12:00"},"duration":{"type":"integer","description":"1枠の時間（分）","example":30}}},"Section":{"type":"object","properties":{"section_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"duration":{"type":"integer","description":"Slot duration in minutes (normal section)"},"max_booking_day":{"type":"integer"},"max_booking_per_slot":{"type":"integer"},"must_book_before_days":{"type":"integer","nullable":true},"max_booking_months":{"type":"integer","nullable":true},"section_type":{"type":"integer","description":"1: normal, 2: flexible"},"schedule_from":{"type":"string"},"schedule_to":{"type":"string"},"status":{"type":"integer"},"cancel_time":{"type":"integer","nullable":true},"cancel_date":{"type":"integer","nullable":true},"from":{"type":"string","description":"Business hours start (HH:mm)"},"to":{"type":"string","description":"Business hours end (HH:mm)"},"time_break":{"type":"array","items":{"type":"object","additionalProperties":true}},"day_periods":{"type":"array","description":"営業時間帯一覧（柔軟タイプ）。通常タイプは空配列。","items":{"$ref":"#/components/schemas/DayPeriod"}},"created_at":{"type":"string","format":"date-time"}}},"SectionListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Section"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"type":"object","additionalProperties":true}}},"AvailableSlot":{"type":"object","properties":{"slot_id":{"type":"string","format":"uuid"},"start_time":{"type":"string","example":"09:00"},"end_time":{"type":"string","example":"09:30"},"section_id":{"type":"string","format":"uuid"},"remaining_inventory":{"type":"integer"},"booking_date":{"type":"string","format":"date"}}},"Booking":{"type":"object","properties":{"booking_id":{"type":"string","format":"uuid"},"booking_code":{"type":"string"},"booking_date":{"type":"string","format":"date"},"from":{"type":"string"},"to":{"type":"string"},"slot_id":{"type":"string","format":"uuid"},"section_id":{"type":"string","format":"uuid"},"section_name":{"type":"string"},"course_id":{"type":"string","format":"uuid","nullable":true},"course_name":{"type":"string","nullable":true},"status":{"type":"integer"},"status_text":{"type":"string"},"allow_update_cancel":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"customer":{"type":"object","additionalProperties":true},"booking_attributes":{"type":"array","items":{"type":"object","additionalProperties":true}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"BookingListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Booking"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"}}},"BookingCreateRequest":{"type":"object","required":["slot_id","booking_date"],"properties":{"slot_id":{"type":"string","format":"uuid"},"booking_date":{"type":"string","format":"date"},"birthday":{"type":"string","format":"date"},"phone":{"type":"string"},"course_id":{"type":"string","format":"uuid"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}}}},"attributes":{"type":"array","items":{"type":"object","properties":{"attribute_id":{"type":"string","format":"uuid"},"value":{"type":"string"}}}},"booking_attributes":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"BookingUpdateRequest":{"allOf":[{"$ref":"#/components/schemas/BookingCreateRequest"}]},"Category":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lower_layer_type":{"type":"string","nullable":true}}},"Attribute":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"name_json":{"type":"string"},"type":{"type":"string"},"is_required":{"type":"boolean"},"options":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}},"security":[{"bearerAuth":[]}]}