# [CRUCIBLE-SEED]
# category: hardcoded_secret
# severity: high
# language: python
# expected: hardcoded GitHub token and Slack webhook URL

import requests

GITHUB_TOKEN = "ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ1234567890"
GITHUB_ORG = "my-company"

SLACK_WEBHOOK_URL = "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
SLACK_BOT_TOKEN = "xoxb-1234567890-1234567890123-abcdefghijklmnopqrstuvwx"

GITHUB_HEADERS = {"Authorization": f"token {GITHUB_TOKEN}", "Accept": "application/vnd.github.v3+json"}


def create_github_issue(repo: str, title: str, body: str) -> dict:
    url = f"https://api.github.com/repos/{GITHUB_ORG}/{repo}/issues"
    response = requests.post(url, json={"title": title, "body": body}, headers=GITHUB_HEADERS)
    return response.json()


def post_slack_message(text: str, channel: str = "#general") -> dict:
    response = requests.post(
        "https://slack.com/api/chat.postMessage",
        headers={"Authorization": f"Bearer {SLACK_BOT_TOKEN}"},
        json={"channel": channel, "text": text},
    )
    return response.json()


def notify_slack_webhook(payload: dict) -> None:
    requests.post(SLACK_WEBHOOK_URL, json=payload)
