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

import betterproto

from settrade.pb.google import type


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


class OrderEquityV3BuySell(betterproto.Enum):
    UNDEFINED_BUYSELL = 0
    BUY = 1
    SELL = 2


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


@dataclass
class OrderEquityV3(betterproto.Message):
    """
    Topic: proto/ua/_broker/<account_no>/_front/ordereqv3 Equity 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)
    # The time the order is submitted
    entry_time: type.TimeOfDay = betterproto.message_field(5)
    # Order Trade Date
    trade_date: type.Date = betterproto.message_field(6)
    # Order Symbol
    symbol: str = betterproto.string_field(7)
    # True if this is an NVDR order, false otherwise
    is_nvdr: bool = betterproto.bool_field(8)
    # Order Price
    price: type.Money = betterproto.message_field(9)
    # Order Price Type - Limit, ATO, ATC, Market (MP-MKT), Special Market (MP),
    # Market to limit (MP-MTL)
    price_type: "OrderEquityV3PriceType" = betterproto.enum_field(10)
    # Side - Buy or Sell
    side: "OrderEquityV3BuySell" = betterproto.enum_field(11)
    # Order Volume
    volume: int = betterproto.int64_field(12)
    # Order Matched Volume
    matched_volume: int = betterproto.int64_field(13)
    # Order Balance Volume Balance Volume = Order Volume - Matched Volume -
    # Cancelled Volume
    balance_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: "OrderEquityV3Valid" = betterproto.enum_field(20)
    # Additional information regarding date if order validity is GTD
    until: type.Date = betterproto.message_field(21)
    # Order Status
    status: str = betterproto.string_field(16)
    # True if available for cancel, false otherwise
    can_cancel: bool = betterproto.bool_field(17)
    # True if available for change price/volume, false otherwise
    can_change_price_vol: bool = betterproto.bool_field(19)
    # True if available for change NVDR, false otherwise
    can_change_nvdr: bool = betterproto.bool_field(22)
    # True if available for change iceberg, false otherwise
    can_change_iceberg: bool = betterproto.bool_field(23)
    # True if available for change account, false otherwise
    can_change_account: bool = betterproto.bool_field(24)
    # True if this order is trade report
    is_trade_report: bool = betterproto.bool_field(25)
