1
import 'package:vkdart/vkontakte.dart';
5
/// See https://dev.vk.com/ru/reference/objects/market-item
6
class MarketAttachmentModel extends CustomAttachmentModel
7
with AttachmentLikesMixin {
8
// ignore: public_member_api_docs
9
MarketAttachmentModel(super.payload) : super(attachType: 'market');
12
String? get title => payload['title'];
14
/// Product description text.
15
String? get description => payload['description'];
17
Map<String, dynamic>? get _price => payload['price'];
18
Map<String, dynamic>? get _dimensions => payload['dimensions'];
19
Map<String, dynamic>? get _category => payload['category'];
20
Map<String, dynamic>? get _rejectInfo => payload['reject_info'];
22
/// the price of a product in hundredths of a currency unit.
23
int? get priceAmount => _price?['amount'];
25
/// currency identifier.
26
int? get priceCurrencyId => _price?['currency']?['id'];
29
String? get priceCurrencyName => _price?['currency']?['name'];
31
/// the old price of a product in hundredths of a currency unit.
32
int? get priceOldAmount => _price?['old_amount'];
34
/// string representation of price.
35
String? get priceText => _price?['text'];
37
/// width in millimeters.
38
int? get dimensionsWidth => _dimensions?['width'];
40
/// height in millimeters.
41
int? get dimensionsHeight => _dimensions?['height'];
43
/// length in millimeters.
44
int? get dimensionsLength => _dimensions?['length'];
47
int? get categoryId => _category?['id'];
50
String? get categoryName => _category?['name'];
52
/// section identifier.
53
int? get categorySectionId => _category?['section']?['id'];
56
String? get categorySectionName => _category?['section']?['name'];
58
/// name of the reason for rejecting the goods.
59
String? get rejectTitle => _rejectInfo?['title'];
61
/// description of the reason for blocking.
62
String? get rejectDescription => _rejectInfo?['description'];
64
/// “Delete” and “Write to support” buttons.
65
Map<String, dynamic>? get rejectButtons => _rejectInfo?['buttons'];
67
/// numerical representation of moderation status.
68
String? get rejectModerationStatus => _rejectInfo?['moderation_status'];
70
/// link to moderation rules.
71
String? get rejectLink => _rejectInfo?['info_link'];
74
String? get rejectWhiteToSupportLink => _rejectInfo?['white_to_support_link'];
77
int? get weight => payload['weight'];
79
/// Product cover image URL.
80
String? get thumbPhoto => payload['thumb_photo'];
82
/// Product creation date in Unixtime format.
83
int? get createdAt => payload['date'];
85
/// Product availability status. Possible values:s
86
/// `0` — product available.
87
/// `1` - product removed.
88
/// `2` - product is unavailable.
89
int? get availability => payload['availability'];
91
/// true if the item has been bookmarked by the current user.
92
bool? get isFavorite => payload['is_favorite'];
94
/// Product article, arbitrary string up to 50 characters long.
95
String? get sku => payload['sku'];
98
List<PhotoAttachmentModel>? get photos => (payload['photos'] as List?)
99
?.map((e) => PhotoAttachmentModel((e as Map).cast<String, dynamic>()))
102
/// Ability to comment on a product for the current user.
103
bool? get isCanComment => checkBoolInProperty('can_comment');
105
/// Ability to repost a product for the current user.
106
bool? get isCanRepost => checkBoolInProperty('can_repost');
108
/// Link to product in external resources.
109
String? get url => payload['url'];
111
/// Text on the product button.
112
String? get buttonTitle => payload['button_title'];