name: VYNDR Morning Odds Scan

on:
  schedule:
    - cron: '0 15 * * *'  # 10am ET
  workflow_dispatch:

jobs:
  morning-odds:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: src/services/python

    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: pip install -r requirements.txt

      - name: Fetch morning odds
        env:
          SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
          SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY }}
          ODDS_API_KEY: ${{ secrets.ODDS_API_KEY }}
          SHADOW_MODE: ${{ vars.SHADOW_MODE }}
        run: |
          python -c "import sys; sys.path.insert(0, '.'); from blueprints.odds_scanner import fetch_and_store_odds; fetch_and_store_odds('nba', 'morning_open'); fetch_and_store_odds('mlb', 'morning_open')"
