# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from . import ai_pb2 as ai__pb2

GRPC_GENERATED_VERSION = '1.82.1'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + ' but the generated code in ai_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class AiServiceStub:
    """AiService 定义 AI 网关契约（D6 智能洞察领域 · 生成子域）
    端口：HTTP 3008 + gRPC 50058（port-allocation.md §3/§5/§7 权威源）
    HTTP 保留作 Gateway 直连降级 + 前端 SSE 流式；gRPC 为 BFF 主入口
    响应信封遵循 ActionState（004 §11.5），降级采用方案 B（总裁裁决 §2.6）
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Chat = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/Chat',
                request_serializer=ai__pb2.ChatRequest.SerializeToString,
                response_deserializer=ai__pb2.ChatResponse.FromString,
                _registered_method=True)
        self.StreamChat = channel.unary_stream(
                '/next_edu_cloud.ai.v1.AiService/StreamChat',
                request_serializer=ai__pb2.ChatRequest.SerializeToString,
                response_deserializer=ai__pb2.ChatChunk.FromString,
                _registered_method=True)
        self.GenerateQuestion = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/GenerateQuestion',
                request_serializer=ai__pb2.GenerateQuestionRequest.SerializeToString,
                response_deserializer=ai__pb2.GeneratedQuestion.FromString,
                _registered_method=True)
        self.StreamGenerateQuestion = channel.unary_stream(
                '/next_edu_cloud.ai.v1.AiService/StreamGenerateQuestion',
                request_serializer=ai__pb2.GenerateQuestionRequest.SerializeToString,
                response_deserializer=ai__pb2.GeneratedQuestionChunk.FromString,
                _registered_method=True)
        self.OptimizeExpression = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/OptimizeExpression',
                request_serializer=ai__pb2.OptimizeExpressionRequest.SerializeToString,
                response_deserializer=ai__pb2.OptimizedExpression.FromString,
                _registered_method=True)
        self.GenerateLessonPlan = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/GenerateLessonPlan',
                request_serializer=ai__pb2.GenerateLessonPlanRequest.SerializeToString,
                response_deserializer=ai__pb2.LessonPlanResponse.FromString,
                _registered_method=True)
        self.GetLessonPlanStatus = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/GetLessonPlanStatus',
                request_serializer=ai__pb2.GetLessonPlanStatusRequest.SerializeToString,
                response_deserializer=ai__pb2.LessonPlanStatus.FromString,
                _registered_method=True)
        self.ConfirmLessonPlan = channel.unary_unary(
                '/next_edu_cloud.ai.v1.AiService/ConfirmLessonPlan',
                request_serializer=ai__pb2.ConfirmLessonPlanRequest.SerializeToString,
                response_deserializer=ai__pb2.ConfirmResult.FromString,
                _registered_method=True)


class AiServiceServicer:
    """AiService 定义 AI 网关契约（D6 智能洞察领域 · 生成子域）
    端口：HTTP 3008 + gRPC 50058（port-allocation.md §3/§5/§7 权威源）
    HTTP 保留作 Gateway 直连降级 + 前端 SSE 流式；gRPC 为 BFF 主入口
    响应信封遵循 ActionState（004 §11.5），降级采用方案 B（总裁裁决 §2.6）
    """

    def Chat(self, request, context):
        """非流式聊天
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamChat(self, request, context):
        """流式聊天（SSE over gRPC）
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GenerateQuestion(self, request, context):
        """生成题目（非流式）
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamGenerateQuestion(self, request, context):
        """题目逐字流式生成
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OptimizeExpression(self, request, context):
        """优化表达
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GenerateLessonPlan(self, request, context):
        """备课工作流启动（4 步编排：分析学情 → 推荐知识点 → 生成题目 → 教师审核）
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetLessonPlanStatus(self, request, context):
        """查询备课工作流状态
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ConfirmLessonPlan(self, request, context):
        """教师确认备课结果入库（调 content.CreateQuestions）
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_AiServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Chat': grpc.unary_unary_rpc_method_handler(
                    servicer.Chat,
                    request_deserializer=ai__pb2.ChatRequest.FromString,
                    response_serializer=ai__pb2.ChatResponse.SerializeToString,
            ),
            'StreamChat': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamChat,
                    request_deserializer=ai__pb2.ChatRequest.FromString,
                    response_serializer=ai__pb2.ChatChunk.SerializeToString,
            ),
            'GenerateQuestion': grpc.unary_unary_rpc_method_handler(
                    servicer.GenerateQuestion,
                    request_deserializer=ai__pb2.GenerateQuestionRequest.FromString,
                    response_serializer=ai__pb2.GeneratedQuestion.SerializeToString,
            ),
            'StreamGenerateQuestion': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamGenerateQuestion,
                    request_deserializer=ai__pb2.GenerateQuestionRequest.FromString,
                    response_serializer=ai__pb2.GeneratedQuestionChunk.SerializeToString,
            ),
            'OptimizeExpression': grpc.unary_unary_rpc_method_handler(
                    servicer.OptimizeExpression,
                    request_deserializer=ai__pb2.OptimizeExpressionRequest.FromString,
                    response_serializer=ai__pb2.OptimizedExpression.SerializeToString,
            ),
            'GenerateLessonPlan': grpc.unary_unary_rpc_method_handler(
                    servicer.GenerateLessonPlan,
                    request_deserializer=ai__pb2.GenerateLessonPlanRequest.FromString,
                    response_serializer=ai__pb2.LessonPlanResponse.SerializeToString,
            ),
            'GetLessonPlanStatus': grpc.unary_unary_rpc_method_handler(
                    servicer.GetLessonPlanStatus,
                    request_deserializer=ai__pb2.GetLessonPlanStatusRequest.FromString,
                    response_serializer=ai__pb2.LessonPlanStatus.SerializeToString,
            ),
            'ConfirmLessonPlan': grpc.unary_unary_rpc_method_handler(
                    servicer.ConfirmLessonPlan,
                    request_deserializer=ai__pb2.ConfirmLessonPlanRequest.FromString,
                    response_serializer=ai__pb2.ConfirmResult.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'next_edu_cloud.ai.v1.AiService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('next_edu_cloud.ai.v1.AiService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class AiService:
    """AiService 定义 AI 网关契约（D6 智能洞察领域 · 生成子域）
    端口：HTTP 3008 + gRPC 50058（port-allocation.md §3/§5/§7 权威源）
    HTTP 保留作 Gateway 直连降级 + 前端 SSE 流式；gRPC 为 BFF 主入口
    响应信封遵循 ActionState（004 §11.5），降级采用方案 B（总裁裁决 §2.6）
    """

    @staticmethod
    def Chat(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/Chat',
            ai__pb2.ChatRequest.SerializeToString,
            ai__pb2.ChatResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamChat(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/StreamChat',
            ai__pb2.ChatRequest.SerializeToString,
            ai__pb2.ChatChunk.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GenerateQuestion(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/GenerateQuestion',
            ai__pb2.GenerateQuestionRequest.SerializeToString,
            ai__pb2.GeneratedQuestion.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamGenerateQuestion(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/StreamGenerateQuestion',
            ai__pb2.GenerateQuestionRequest.SerializeToString,
            ai__pb2.GeneratedQuestionChunk.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def OptimizeExpression(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/OptimizeExpression',
            ai__pb2.OptimizeExpressionRequest.SerializeToString,
            ai__pb2.OptimizedExpression.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GenerateLessonPlan(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/GenerateLessonPlan',
            ai__pb2.GenerateLessonPlanRequest.SerializeToString,
            ai__pb2.LessonPlanResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetLessonPlanStatus(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/GetLessonPlanStatus',
            ai__pb2.GetLessonPlanStatusRequest.SerializeToString,
            ai__pb2.LessonPlanStatus.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ConfirmLessonPlan(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/next_edu_cloud.ai.v1.AiService/ConfirmLessonPlan',
            ai__pb2.ConfirmLessonPlanRequest.SerializeToString,
            ai__pb2.ConfirmResult.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
