Skip to main content

rustigram_types/
business.rs

1use serde::{Deserialize, Serialize};
2
3use crate::chat::Location;
4use crate::sticker::Sticker;
5
6/// The intro shown on a business account's profile.
7#[derive(Debug, Clone, Default, Serialize, Deserialize)]
8#[non_exhaustive]
9pub struct BusinessIntro {
10    /// Title text of the business intro.
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub title: Option<String>,
13    /// Message text of the business intro.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub message: Option<String>,
16    /// Sticker shown in the business intro.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub sticker: Option<Sticker>,
19}
20
21/// The physical location of a business account.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23#[non_exhaustive]
24pub struct BusinessLocation {
25    /// Address of the business.
26    pub address: String,
27    /// Location of the business.
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub location: Option<Location>,
30}
31
32/// A single interval in a business account's opening hours.
33///
34/// Minutes are counted from the start of the week — 0 is midnight on Monday in
35/// the account's [`time_zone_name`](BusinessOpeningHours::time_zone_name).
36#[derive(Debug, Clone, Default, Serialize, Deserialize)]
37#[non_exhaustive]
38pub struct BusinessOpeningHoursInterval {
39    /// Minute of the week when the business opens.
40    pub opening_minute: u32,
41    /// Minute of the week when the business closes.
42    pub closing_minute: u32,
43}
44
45/// The opening hours of a business account.
46#[derive(Debug, Clone, Default, Serialize, Deserialize)]
47#[non_exhaustive]
48pub struct BusinessOpeningHours {
49    /// Unique name of the time zone the opening hours are defined in.
50    pub time_zone_name: String,
51    /// List of time intervals describing business opening hours.
52    pub opening_hours: Vec<BusinessOpeningHoursInterval>,
53}
54
55/// A user's birthdate.
56#[derive(Debug, Clone, Default, Serialize, Deserialize)]
57#[non_exhaustive]
58pub struct Birthdate {
59    /// Day of the user's birth (1–31).
60    pub day: u8,
61    /// Month of the user's birth (1–12).
62    pub month: u8,
63    /// Year of the user's birth, if the user chose to share it.
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub year: Option<u16>,
66}
67
68/// A user's Telegram rating.
69#[derive(Debug, Clone, Default, Serialize, Deserialize)]
70#[non_exhaustive]
71pub struct UserRating {
72    /// Current level of the user.
73    pub level: i64,
74    /// Current rating of the user.
75    pub rating: i64,
76    /// Rating required to reach the current level.
77    pub current_level_rating: i64,
78    /// Rating required to reach the next level; omitted at the maximum level.
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub next_level_rating: Option<i64>,
81}