# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: orderdvv3.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime

import betterproto

from settrade.pb.google import type


class OrderDerivV3PriceType(betterproto.Enum):
    UNDEFINED_PRICE_TYPE = 0
    LIMIT = 1
    ATO = 2
    ATC = 3
    MARKET = 4
    MARKET_TO_LIMIT = 6


class OrderDerivV3LongShort(betterproto.Enum):
    UNDEFINED_LONGSHORT = 0
    LONG = 1
    SHORT = 2
    LONG_AND_SHORT = 3


class OrderDerivV3Position(betterproto.Enum):
    UNDEFINED_POSITION = 0
    OPEN = 1
    CLOSE = 2
    AUTO = 3


class OrderDerivV3Valid(betterproto.Enum):
    UNDEFINED_VALID = 0
    FOK = 1
    IOC = 2
    GTD = 3
    GTC = 4
    DAY = 8


@dataclass
class OrderDerivV3(betterproto.Message):
    """
    Topic: proto/ua/_broker/<account_no>/_front/orderdvv3 Derivative order
    information
    """

    # Order version. Greater version means more recent order
    version: int = betterproto.int32_field(1)
    # Settrade order no.
    order_no: str = betterproto.string_field(2)
    # External order no. in case of using integrated account, otherwise blank
    ext_order_no: str = betterproto.string_field(3)
    # Subscribed account no.
    account_no: str = betterproto.string_field(4)
    # ID of Market Representative who placed this order Blank if investor place
    # order by him or herself
    enter_id: str = betterproto.string_field(5)
    # The time the order is submitted
    entry_time: datetime = betterproto.message_field(6)
    # Series ID or symbol
    series_id: str = betterproto.string_field(7)
    # Side - Long, Short or both
    side: "OrderDerivV3LongShort" = betterproto.enum_field(8)
    # Position - Open, Close, Auto
    position: "OrderDerivV3Position" = betterproto.enum_field(9)
    # Order Price
    price: type.Money = betterproto.message_field(10)
    # Order Price Type - Limit, ATO, ATC, Market (MP-MKT), Special Market (MP),
    # Market to limit (MP-MTL)
    price_type: "OrderDerivV3PriceType" = betterproto.enum_field(11)
    # Order Volume
    volume: int = betterproto.int64_field(12)
    # Order Balance Volume Balance Volume = Order Volume - Matched Volume -
    # Cancelled Volume
    balance_volume: int = betterproto.int64_field(13)
    # Order Matched Volume
    matched_volume: int = betterproto.int64_field(14)
    # Order Cancelled Volume
    cancelled_volume: int = betterproto.int64_field(15)
    # Validity of order - FOK, IOC, GTD, GTC, GTT, GTS, AUCTION, DAY, AUTO-M
    valid: "OrderDerivV3Valid" = betterproto.enum_field(16)
    # Additional information regarding date if order validity is GTD
    until: str = betterproto.string_field(17)
    # Order Status
    status: str = betterproto.string_field(18)
    # True if available for cancel, false otherwise
    can_cancel: bool = betterproto.bool_field(19)
    # True if available for change nvdr, false otherwise
    can_change: bool = betterproto.bool_field(20)
    # True if available for change price/volume, false otherwise
    can_change_price_vol: bool = betterproto.bool_field(21)
    # True if this order is trade report
    is_trade_report: bool = betterproto.bool_field(22)
