import requests

url = "http://127.0.0.1:8000/api/v1/life-insurance/"
# We need to register/login first to get a token
login_url = "http://127.0.0.1:8000/api/auth/login"
resp = requests.post(login_url, json={"username": "browsere2e@example.com", "password": "BrowserE2E@123"})
print("Login status:", resp.status_code)
token = resp.json().get("access_token")
print("Access token length:", len(token) if token else None)

headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}

payload = {
    "full_name": "Browser E2E User",
    "date_of_birth": "1990-01-01",
    "gender": "Male",
    "email_address": "browsere2e@example.com",
    "phone_number": "1234588888",
    "state": "NY",
    "zip_code": "12345",
    "marital_status": "Single",
    "ssn_last4": "1234",
    "address_line1": "123 Main St",
    "address_line2": "",
    "city": "New York",
    "employment_status": "Employed",
    "occupation": "Professional",
    "annual_income": 50000.0,
    "height": "6ft 0in",
    "weight": 180.0,
    "tobacco_use": False,
    "alcohol_consumption": "Occasional",
    "existing_conditions": [],
    "medications": [],
    "family_history": [],
    "coverage_amount": 100000.0,
    "coverage_term": "20 Year Term",
    "product_type": "Term Life",
    "premium_budget": 100.0,
    "payment_frequency": "Monthly",
    "riders": [],
    "primary_beneficiary_name": "Spouse",
    "primary_beneficiary_relationship": "Spouse",
    "beneficiary_percentage": 100.0,
    "contingent_beneficiary_name": "",
    "contingent_beneficiary_relationship": "",
    "citizenship_status": "US Citizen",
    "country_of_citizenship": "United States",
    "us_citizen": True,
    "criminal_record": False,
    "bankruptcy_history": False,
    "consent_to_contact": True,
    "consent_to_share_data": True,
    "signature": "Browser E2E User"
}

post_resp = requests.post(url, json=payload, headers=headers)
print("Post status:", post_resp.status_code)
print("Post response:", post_resp.text)
