from kite_bracket_orders import BracketOrderPlacer, run_login, KiteDashboard

# Define your order data here (edit as needed for easy order placement - used when choice "1" is selected)

order_data = {
    "segment": "NSE",                  # "NSE" or "NFO"
    "product_type": "MIS",             # "MIS" or "CNC" or "NRML"
    "side": "SELL",                    # "BUY" or "SELL"
    "entry_order_type": "LIMIT",       # "LIMIT" or "MARKET"
    "sl_type": "SL-M",                 # choose: "SL" or "SL-M"

    "symbol": "IDEA",                  # e.g. "IDEA", "RELIANCE", or "NIFTY24JUL20000CE"
    "quantity": 1,                     # Must match lot size for options; 1+ for stocks
    "entry_price": 7.60,               # Only used if LIMIT order
    "target_price": 7.80,
    "stop_loss_trigger": 7.50,
    "stop_loss_limit": 0               # only used if SL (not SL-M)
}

if __name__ == "__main__":
    
    enable_logging = True  # If False, logs are disabled (no log file output or redirection)

    run_login() # Run login (installs deps if needed, prompts if config missing, generates token)

    # Show dashboard
    dash = KiteDashboard()
    dash.show_all()

    # Proceed to bracket order
    placer = BracketOrderPlacer(code_data=order_data, enable_logging=enable_logging)  # Pass order_data for choice "1" and logging toggle
    placer.load_kite_login_name_show()
    placer.place_bracket_order()  # No args needed - prompt happens inside
