import logging
from app.broker.base_broker import BaseBroker

logger = logging.getLogger(__name__)

# PHASE-2 FIX (Goals 5 & 6): place_order/modify_order/cancel_order previously
# faked a successful response ({"status": "success"}) unconditionally, even
# though connect() already honestly reports this broker isn't implemented.
# Any caller checking .get("success") on the old place_order response would
# get None (falsy) rather than an explicit failure — now explicit everywhere.
_NOT_IMPLEMENTED = "AliceBlue integration is not implemented — no real API calls are made."


class AliceBlueBroker(BaseBroker):

    def connect(self):
        logger.info("AliceBlue: connect called — not implemented")
        return {"success": False, "message": _NOT_IMPLEMENTED}

    def disconnect(self):
        logger.info("AliceBlue: disconnect called")
        return {"success": True}

    def is_connected(self):
        return False

    def profile(self):
        return {"success": False, "message": _NOT_IMPLEMENTED}

    def funds(self):
        return {"success": False, "message": _NOT_IMPLEMENTED}

    def holdings(self):
        return []

    def positions(self):
        return []

    def orders(self):
        return []

    def place_order(self, order):
        return {"success": False, "status": "error", "message": _NOT_IMPLEMENTED}

    def modify_order(self, order_id, order):
        return {"success": False, "status": "error", "message": _NOT_IMPLEMENTED}

    def cancel_order(self, order_id):
        return {"success": False, "status": "error", "message": _NOT_IMPLEMENTED}

    def quotes(self, symbol):
        return {}

    def historical_data(self, symbol):
        return []

    def live_data(self, symbol):
        return {}