service->update($draw, $request->validated()); } catch (\RuntimeException $e) { $message = match ($e->getMessage()) { 'draw_no_exists' => trans('api.draw_no_exists'), 'draw_timeline_invalid' => trans('api.draw_timeline_invalid'), 'draw_not_editable' => trans('api.draw_not_editable'), 'draw_has_bets' => trans('api.draw_has_bets'), 'draw_result_exists' => trans('api.draw_result_exists'), default => trans('api.client_error'), }; return ApiResponse::error($message, ErrorCode::ClientHttpError->value, ['reason' => $e->getMessage()], 409); } return ApiResponse::success([ 'id' => (int) $updated->id, 'draw_no' => $updated->draw_no, 'business_date' => (string) $updated->business_date, 'sequence_no' => (int) $updated->sequence_no, 'status' => $updated->status, 'start_time' => $updated->start_time?->toIso8601String(), 'close_time' => $updated->close_time?->toIso8601String(), 'draw_time' => $updated->draw_time?->toIso8601String(), ]); } }