from fastapi import APIRouter, Depends, HTTPException from core.database import fake_users_db from pydantic import BaseModel import uuid router = APIRouter() class CompanyRegistration(BaseModel): company_name: str user_name: str email: str password: str role: str = "employee" @router.post("/register/company") async def register_company_user(registration: CompanyRegistration): """Register a new user in a company""" user_id = str(uuid.uuid4()) if registration.email in [user["email"] for user in fake_users_db.values()]: raise HTTPException(status_code=400, detail="Email already registered") fake_users_db[registration.user_name] = { "id": user_id, "company_name": registration.company_name, "email": registration.email, "password": registration.password, "role": registration.role, "disabled": False } return { "message": "Company user registered successfully", "user_id": user_id, "company_name": registration.company_name, "username": registration.user_name, "next_steps": [ "Verify your email address", "Complete company profile", "Set up team members" ], "features": { "rate_limit": 100, "expires_in": 3600 } }