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

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

from typing import Optional

from msgspec import Struct

from .. import definitions


class CreateAlgoOrderRequestForTwapAlgo(Struct, omit_defaults=True):
    algo_name: str
    params: definitions.TwapParams
    account: Optional[str] = None
    algo_order_id: Optional[definitions.OrderId] = None
    parent_order_id: Optional[definitions.OrderId] = None
    trader: Optional[definitions.UserId] = None

    # Constructor that takes all field titles as arguments for convenience
    @classmethod
    def new(
        cls,
        algo_name: str,
        params: definitions.TwapParams,
        account: Optional[str] = None,
        algo_order_id: Optional[definitions.OrderId] = None,
        parent_order_id: Optional[definitions.OrderId] = None,
        trader: Optional[definitions.UserId] = None,
    ):
        return cls(
            algo_name,
            params,
            account,
            algo_order_id,
            parent_order_id,
            trader,
        )

    def __str__(self) -> str:
        return f"CreateAlgoOrderRequestForTwapAlgo(algo_name={self.algo_name},params={self.params},account={self.account},algo_order_id={self.algo_order_id},parent_order_id={self.parent_order_id},trader={self.trader})"

    @staticmethod
    def get_response_type():
        return AlgoOrderForTwapAlgo

    @staticmethod
    def get_unannotated_response_type():
        return AlgoOrderForTwapAlgo

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

    @staticmethod
    def get_rpc_method():
        return "unary"
