# app.py for notification-service-py

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/notifications/send', methods=['POST'])
def send_notification():
    """Sends a notification to a user."""
    data = request.get_json()
    user_id = data.get('user_id')
    message = data.get('message')

    if not user_id or not message:
        return jsonify({"error": "user_id and message are required"}), 400

    print(f"Sending notification to user {user_id}: {message}")
    # In a real application, this would integrate with an email/SMS/push notification service
    return jsonify({"message": f"Notification sent successfully to user {user_id}"}), 200

if __name__ == '__main__':
    # Run the Flask app on port 8083
    app.run(host='0.0.0.0', port=8083)
