from sqlalchemy.orm import Session from app.schemas.auth.tenant_schema import TenantCreate, TenantUpdate from app.services.auth.tenant_service import TenantService import uuid from typing import List, Optional class TenantController: @staticmethod def create_tenant(db: Session, tenant_data: TenantCreate, actor=None): return TenantService.create_tenant(db, tenant_data, actor=actor) @staticmethod def get_all_tenants(db: Session): return TenantService.get_all_tenants(db) @staticmethod def get_tenant_by_id(db: Session, tenant_id: uuid.UUID): return TenantService.get_tenant_by_id(db, tenant_id) @staticmethod def update_tenant(db: Session, tenant_id: uuid.UUID, tenant_data: TenantUpdate, actor=None): return TenantService.update_tenant(db, tenant_id, tenant_data, actor=actor) @staticmethod def subscription_history(db: Session, tenant_id: uuid.UUID, limit: int = 50): from app.services.auth import subscription_history as history return history.history_for(db, tenant_id, limit=limit) @staticmethod def delete_tenant(db: Session, tenant_id: uuid.UUID): return TenantService.delete_tenant(db, tenant_id) @staticmethod def get_tenants_paginated( db: Session, page: int, page_size: int, search: Optional[str], is_active: Optional[bool], filter_tenant_names: Optional[List[str]] = None, filter_tenant_domains: Optional[List[str]] = None, filter_plan_ids: Optional[List[uuid.UUID]] = None, statuses: Optional[List[bool]] = None, sort_by: Optional[str] = None, sort_order: Optional[str] = None, ): return TenantService.get_tenants_paginated( db=db, page=page, page_size=page_size, search=search, is_active=is_active, filter_tenant_names=filter_tenant_names, filter_tenant_domains=filter_tenant_domains, filter_plan_ids=filter_plan_ids, statuses=statuses, sort_by=sort_by, sort_order=sort_order, )