"""
Example usage of Commercial Auto API endpoints
"""
import requests
import json
from datetime import date

BASE_URL = "http://localhost:8000/api/v1/commercial-auto"

# Example vehicle list (JSON string)
vehicle_list = json.dumps([
    {"year": 2020, "make": "Ford", "model": "Transit", "vin": "1FTBW2CM5LKA12345"},
    {"year": 2019, "make": "Chevrolet", "model": "Express", "vin": "1GCWGBFG5K1234567"}
])

# Example driver list (JSON string)
driver_list = json.dumps([
    {"name": "John Smith", "date_of_birth": "1985-03-15", "license_number": "D123456789", "license_state": "CA"},
    {"name": "Jane Doe", "date_of_birth": "1990-07-22", "license_number": "D987654321", "license_state": "CA"}
])

example_quote_data = {
    "business_name": "ABC Delivery Services",
    "contact_name": "John Smith",
    "email_address": "john.smith@abcdelivery.com",
    "phone_number": "(555) 123-4567",
    "business_address": "123 Business Ave, City, ST 12345",
    "type_of_business": "delivery",
    "business_entity_type": "llc",
    "years_in_business": 5,
    "annual_revenue": 500000.00,
    "number_of_vehicles": 2,
    "vehicle_list": vehicle_list,
    "vehicle_use_type": "delivery",
    "radius_of_operation": "local_50_miles",
    "garaging_zip_codes": "12345,12346",
    "vehicles_cross_state_lines": False,
    "driver_list": driver_list,
    "driver_experience_years": 10,
    "drivers_under_25": False,
    "mvr_violations_past_3_years": False,
    "description_of_violations": None,
    "accidents_claims_past_5_years": False,
    "description_of_accidents_claims": None,
    "current_auto_insurance": True,
    "current_carrier": "Previous Insurance Co",
    "current_policy_expiration_date": "2024-12-31",
    "desired_coverage_types": "liability,collision,comprehensive",
    "desired_coverage_limits": 1000000.00,
    "comprehensive_collision_deductibles": 1000.00,
    "hired_non_owned_coverage_needed": True,
    "special_equipment_on_vehicles": False,
    "description_of_equipment": None,
    "desired_policy_start_date": "2024-01-01",
    "broker_agent_name": "Agent Smith",
    "notes_special_requests": "Need quick turnaround for quote"
}

def create_quote():
    response = requests.post(f"{BASE_URL}/quotes", json=example_quote_data)
    if response.status_code == 201:
        print("Quote created successfully!")
        return response.json()
    else:
        print(f"Error: {response.status_code}")
        print(response.text)
        return None

if __name__ == "__main__":
    quote = create_quote()
    if quote:
        print(f"Created quote with ID: {quote['id']}")