lighter-rust 0.2.0

A comprehensive Rust SDK for the Lighter trading platform with async/await, WebSocket support, and Ethereum wallet integration
/*
 *
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document:
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DetailedAccount {
    #[serde(rename = "code")]
    pub code: i32,
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    #[serde(rename = "account_type")]
    pub account_type: i32,
    #[serde(rename = "index")]
    pub index: i64,
    #[serde(rename = "l1_address")]
    pub l1_address: String,
    #[serde(rename = "cancel_all_time")]
    pub cancel_all_time: i64,
    #[serde(rename = "total_order_count")]
    pub total_order_count: i64,
    #[serde(rename = "total_isolated_order_count")]
    pub total_isolated_order_count: i64,
    #[serde(rename = "pending_order_count")]
    pub pending_order_count: i64,
    #[serde(rename = "available_balance")]
    pub available_balance: String,
    #[serde(rename = "status")]
    pub status: i32,
    #[serde(rename = "collateral")]
    pub collateral: String,
    #[serde(rename = "account_index")]
    pub account_index: i64,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "description")]
    pub description: String,
    ///  Remove After FE uses L1 meta endpoint
    #[serde(rename = "can_invite")]
    pub can_invite: bool,
    ///  Remove After FE uses L1 meta endpoint
    #[serde(rename = "referral_points_percentage")]
    pub referral_points_percentage: String,
    #[serde(rename = "positions")]
    pub positions: Vec<models::AccountPosition>,
    #[serde(rename = "total_asset_value", skip_serializing_if = "Option::is_none")]
    pub total_asset_value: Option<String>,
    #[serde(rename = "cross_asset_value", skip_serializing_if = "Option::is_none")]
    pub cross_asset_value: Option<String>,
    #[serde(rename = "pool_info", skip_serializing_if = "Option::is_none")]
    pub pool_info: Option<Box<models::PublicPoolInfo>>,
    #[serde(rename = "shares", skip_serializing_if = "Option::is_none")]
    pub shares: Option<Vec<models::PublicPoolShare>>,
}

impl DetailedAccount {
    pub fn new(
        code: i32,
        account_type: i32,
        index: i64,
        l1_address: String,
        cancel_all_time: i64,
        total_order_count: i64,
        total_isolated_order_count: i64,
        pending_order_count: i64,
        available_balance: String,
        status: i32,
        collateral: String,
        account_index: i64,
        name: String,
        description: String,
        can_invite: bool,
        referral_points_percentage: String,
        positions: Vec<models::AccountPosition>,
    ) -> DetailedAccount {
        DetailedAccount {
            code,
            message: None,
            account_type,
            index,
            l1_address,
            cancel_all_time,
            total_order_count,
            total_isolated_order_count,
            pending_order_count,
            available_balance,
            status,
            collateral,
            account_index,
            name,
            description,
            can_invite,
            referral_points_percentage,
            positions,
            total_asset_value: None,
            cross_asset_value: None,
            pool_info: None,
            shares: None,
        }
    }
}