Coverage for packages/clopos/src/integrify/clopos/schemas/common/object.py: 100%

144 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-10-19 02:39 +0000

1from decimal import Decimal 

2from typing import Literal 

3 

4from integrify.clopos.schemas.enums import ProductType 

5from integrify.utils import UnsetOrNoneField 

6from pydantic import BaseModel, Field 

7 

8 

9class Timestamp(BaseModel): 

10 created_at: str 

11 """The timestamp when the object was created""" 

12 

13 updated_at: str 

14 """The timestamp when the object was last updated""" 

15 

16 deleted_at: UnsetOrNoneField[str] 

17 """The timestamp when the object was deleted""" 

18 

19 

20class Balance(Timestamp): 

21 id: int 

22 """Balance ID""" 

23 

24 system_type: UnsetOrNoneField[str] 

25 """The system type of the balance""" 

26 

27 venue_id: UnsetOrNoneField[int] 

28 """The ID of the venue the balance belongs to""" 

29 

30 name: UnsetOrNoneField[str] 

31 """The name of the balance""" 

32 

33 description: UnsetOrNoneField[str] 

34 """The description of the balance""" 

35 

36 type: str 

37 """Balance type""" 

38 

39 amount: Decimal 

40 """The balance amount""" 

41 

42 position: int 

43 """The position of the balance""" 

44 

45 

46class CashbackBalance(BaseModel): 

47 name: UnsetOrNoneField[str] 

48 """The name of the balance""" 

49 

50 type: str 

51 """Balance type""" 

52 

53 amount: Decimal 

54 """The balance amount""" 

55 

56 

57class Image(BaseModel): 

58 original: UnsetOrNoneField[str] 

59 """The original image URL""" 

60 

61 large: UnsetOrNoneField[str] 

62 """The large image URL""" 

63 

64 extra_large: UnsetOrNoneField[str] 

65 """The extra large image URL""" 

66 

67 thumb: UnsetOrNoneField[str] 

68 """The thumbnail image URL""" 

69 

70 blur_hash: UnsetOrNoneField[str] 

71 """The blur hash of the image""" 

72 

73 

74class Media(BaseModel): 

75 uuid: UnsetOrNoneField[str] 

76 """The UUID of the media""" 

77 

78 mime_type: UnsetOrNoneField[str] 

79 """The MIME type of the media""" 

80 

81 size: UnsetOrNoneField[int] 

82 """The size of the media in bytes""" 

83 

84 urls: Image 

85 """The image URLs of the media""" 

86 

87 blur_hash: UnsetOrNoneField[str] 

88 """The blur hash of the media""" 

89 

90 dimensions: UnsetOrNoneField[dict] 

91 """The dimensions of the media""" 

92 

93 

94class Variant(BaseModel): 

95 """List of product variants (for GOODS)""" 

96 

97 id: int 

98 """Modification ID""" 

99 

100 parent_id: UnsetOrNoneField[int] 

101 """The identifier of the parent product""" 

102 

103 type: Literal[ProductType.MODIFICATION] 

104 """Modification type""" 

105 

106 name: str 

107 """The name of the variant (e.g., "0.5 L")""" 

108 

109 price: Decimal 

110 """The sales price of the variant""" 

111 

112 cost_price: Decimal 

113 """The cost price of the variant""" 

114 

115 barcode: UnsetOrNoneField[str] 

116 """The barcode of the variant""" 

117 

118 full_name: UnsetOrNoneField[str] 

119 """The full name of the variant""" 

120 

121 status: int 

122 """The status of the variant (1: Active, 0: Inactive)""" 

123 

124 

125class Modifier(BaseModel): 

126 id: int 

127 """The modifier's identifier""" 

128 

129 name: str 

130 """The name of the modifier (e.g., "Spicy")""" 

131 

132 price: Decimal 

133 """The sales price of the modifier""" 

134 

135 ingredient: UnsetOrNoneField[dict] 

136 """If the modifier is linked to an ingredient, contains ingredient information""" 

137 

138 

139class ModifierGroup(Timestamp): 

140 """List of modifier groups (for DISH)""" 

141 

142 id: int 

143 """The group's identifier""" 

144 

145 name: str 

146 """The name of the group (e.g., "Spice Level")""" 

147 

148 type: int 

149 """Selection rule (1: Single-choice, 0: Multi-choice)""" 

150 

151 min_select: int 

152 """Minimum number of selections""" 

153 

154 max_select: int 

155 """Maximum number of selections""" 

156 

157 modifiers: UnsetOrNoneField[list[Modifier]] 

158 """The modifiers in the group""" 

159 

160 adjust_to_portion: bool 

161 """Whether the group is adjusted to the portion size""" 

162 

163 status: UnsetOrNoneField[bool] 

164 """The status of the group""" 

165 

166 meta: UnsetOrNoneField[dict] 

167 """The metadata of the group""" 

168 

169 pivot: UnsetOrNoneField[dict] 

170 """The pivot information of the group""" 

171 

172 

173class Package(BaseModel): 

174 """List of purchasing packages (for INGREDIENT)""" 

175 

176 id: int 

177 """The package’s identifier""" 

178 

179 name: str 

180 """The name of the package (e.g., “Bundle 10 pcs”)""" 

181 

182 equal: int 

183 """The number of base units contained in the package""" 

184 

185 

186class Tax(BaseModel): 

187 id: int 

188 """Tax ID""" 

189 

190 name: str 

191 """Tax name""" 

192 

193 rate: Decimal 

194 """Tax rate""" 

195 

196 

197class Price(BaseModel): 

198 price: Decimal 

199 """Price""" 

200 

201 from_: UnsetOrNoneField[int] = Field(alias='from') 

202 """From which period""" 

203 

204 venue_id: UnsetOrNoneField[int] 

205 """The venue ID""" 

206 

207 

208class TimerSetting(BaseModel): 

209 interval: int 

210 """The pricing interval in minutes""" 

211 

212 prices: list[Price] 

213 """List of prices by intervals""" 

214 

215 

216class Service(BaseModel): 

217 sale_type_id: UnsetOrNoneField[int] 

218 """The sale type ID""" 

219 

220 sale_type_name: UnsetOrNoneField[str] 

221 """The name of the sale type""" 

222 

223 venue_id: UnsetOrNoneField[int] 

224 """The venue ID""" 

225 

226 venue_name: UnsetOrNoneField[str] 

227 """The name of the venue"""