# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from __future__ import annotations

from typing import List

from alibabacloud_aicontent20240611 import models as main_models
from darabonba.model import DaraModel

class ExecuteAITeacherSyncDialogueTranslateRequest(DaraModel):
    def __init__(
        self,
        dialogue_tasks: List[main_models.ExecuteAITeacherSyncDialogueTranslateRequestDialogueTasks] = None,
        records: List[main_models.ExecuteAITeacherSyncDialogueTranslateRequestRecords] = None,
        user_id: str = None,
    ):
        # This parameter is required.
        self.dialogue_tasks = dialogue_tasks
        self.records = records
        # This parameter is required.
        self.user_id = user_id

    def validate(self):
        if self.dialogue_tasks:
            for v1 in self.dialogue_tasks:
                 if v1:
                    v1.validate()
        if self.records:
            for v1 in self.records:
                 if v1:
                    v1.validate()

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        result['dialogueTasks'] = []
        if self.dialogue_tasks is not None:
            for k1 in self.dialogue_tasks:
                result['dialogueTasks'].append(k1.to_map() if k1 else None)

        result['records'] = []
        if self.records is not None:
            for k1 in self.records:
                result['records'].append(k1.to_map() if k1 else None)

        if self.user_id is not None:
            result['userId'] = self.user_id

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        self.dialogue_tasks = []
        if m.get('dialogueTasks') is not None:
            for k1 in m.get('dialogueTasks'):
                temp_model = main_models.ExecuteAITeacherSyncDialogueTranslateRequestDialogueTasks()
                self.dialogue_tasks.append(temp_model.from_map(k1))

        self.records = []
        if m.get('records') is not None:
            for k1 in m.get('records'):
                temp_model = main_models.ExecuteAITeacherSyncDialogueTranslateRequestRecords()
                self.records.append(temp_model.from_map(k1))

        if m.get('userId') is not None:
            self.user_id = m.get('userId')

        return self

class ExecuteAITeacherSyncDialogueTranslateRequestRecords(DaraModel):
    def __init__(
        self,
        content: str = None,
        is_off_topic_control: bool = None,
        is_on_topic: bool = None,
        order: int = None,
        role: str = None,
    ):
        # This parameter is required.
        self.content = content
        self.is_off_topic_control = is_off_topic_control
        self.is_on_topic = is_on_topic
        # This parameter is required.
        self.order = order
        # This parameter is required.
        self.role = role

    def validate(self):
        pass

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.content is not None:
            result['content'] = self.content

        if self.is_off_topic_control is not None:
            result['isOffTopicControl'] = self.is_off_topic_control

        if self.is_on_topic is not None:
            result['isOnTopic'] = self.is_on_topic

        if self.order is not None:
            result['order'] = self.order

        if self.role is not None:
            result['role'] = self.role

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('content') is not None:
            self.content = m.get('content')

        if m.get('isOffTopicControl') is not None:
            self.is_off_topic_control = m.get('isOffTopicControl')

        if m.get('isOnTopic') is not None:
            self.is_on_topic = m.get('isOnTopic')

        if m.get('order') is not None:
            self.order = m.get('order')

        if m.get('role') is not None:
            self.role = m.get('role')

        return self

class ExecuteAITeacherSyncDialogueTranslateRequestDialogueTasks(DaraModel):
    def __init__(
        self,
        assistant: str = None,
        assistant_translate: str = None,
        order: int = None,
        user: str = None,
    ):
        # This parameter is required.
        self.assistant = assistant
        self.assistant_translate = assistant_translate
        # This parameter is required.
        self.order = order
        # This parameter is required.
        self.user = user

    def validate(self):
        pass

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.assistant is not None:
            result['assistant'] = self.assistant

        if self.assistant_translate is not None:
            result['assistantTranslate'] = self.assistant_translate

        if self.order is not None:
            result['order'] = self.order

        if self.user is not None:
            result['user'] = self.user

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('assistant') is not None:
            self.assistant = m.get('assistant')

        if m.get('assistantTranslate') is not None:
            self.assistant_translate = m.get('assistantTranslate')

        if m.get('order') is not None:
            self.order = m.get('order')

        if m.get('user') is not None:
            self.user = m.get('user')

        return self

