#!/bin/bash

BASE_URL="http://lvh.me:8000/auth/signup/"

echo "1. Testing Successful Signup (testcompany11)..."
curl -s -X POST $BASE_URL \
  -H "Content-Type: application/json" \
  -d '{"subdomain": "testcompany11", "business_name": "Test 11", "email": "test11@example.com", "password": "password123", "first_name": "Test", "last_name": "User"}' \
  | grep "access" && echo "SUCCESS" || echo "FAILED"

echo -e "\n2. Testing Duplicate Subdomain (testcompany11)..."
curl -s -X POST $BASE_URL \
  -H "Content-Type: application/json" \
  -d '{"subdomain": "testcompany11", "business_name": "Test 11 Duplicate", "email": "test11_dup@example.com", "password": "password123", "first_name": "Test", "last_name": "User"}' \
  | grep "detail"

echo -e "\n3. Testing Duplicate Email (test11@example.com)..."
curl -s -X POST $BASE_URL \
  -H "Content-Type: application/json" \
  -d '{"subdomain": "testcompany12", "business_name": "Test 12", "email": "test11@example.com", "password": "password123", "first_name": "Test", "last_name": "User"}' \
  | grep "detail"

echo -e "\n4. Testing Missing Subdomain..."
curl -s -X POST $BASE_URL \
  -H "Content-Type: application/json" \
  -d '{"business_name": "Test 13", "email": "test13@example.com", "password": "password123"}' \
  | grep "detail"
