# generated by datamodel-codegen:
#   filename:  Algo/CreateAlgoOrderRequest.json

from __future__ import annotations
from architect_py.grpc.models.Algo.AlgoOrder import AlgoOrder

from typing import Any, Optional

from msgspec import Struct

from .. import definitions


class CreateAlgoOrderRequest(Struct, omit_defaults=True):
    algo: str
    params: Any
    id: Optional[definitions.OrderId] = None
    parent_id: Optional[definitions.OrderId] = None
    trader: Optional[definitions.TraderIdOrEmail] = None

    # Constructor that takes all field titles as arguments for convenience
    @classmethod
    def new(
        cls,
        algo: str,
        params: Any,
        id: Optional[definitions.OrderId] = None,
        parent_id: Optional[definitions.OrderId] = None,
        trader: Optional[definitions.TraderIdOrEmail] = None,
    ):
        return cls(
            algo,
            params,
            id,
            parent_id,
            trader,
        )

    def __str__(self) -> str:
        return f"CreateAlgoOrderRequest(algo={self.algo},params={self.params},id={self.id},parent_id={self.parent_id},trader={self.trader})"

    @staticmethod
    def get_response_type():
        return AlgoOrder

    @staticmethod
    def get_unannotated_response_type():
        return AlgoOrder

    @staticmethod
    def get_route() -> str:
        return "/json.architect.Algo/CreateAlgoOrder"

    @staticmethod
    def get_rpc_method():
        return "unary"
