summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/SevereCloud/vksdk/v2/object/groups.go
blob: 6cabae01dcfe9289a831741b8061310354f98671 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
package object // import "github.com/SevereCloud/vksdk/v2/object"

import (
	"bytes"
	"encoding/json"
	"fmt"
	"reflect"

	"github.com/vmihailenco/msgpack/v5"
	"github.com/vmihailenco/msgpack/v5/msgpcode"
)

// GroupsAddress WorkInfoStatus of information about timetable.
const (
	WorkStatusNoInformation     = "no_information"
	WorkStatusTemporarilyClosed = "temporarily_closed"
	WorkStatusAlwaysOpened      = "always_opened"
	WorkStatusTimetable         = "timetable"
	WorkStatusForeverClosed     = "forever_closed"
)

// GroupsAddress struct.
type GroupsAddress struct {
	// Additional address to the place (6 floor, left door).
	AdditionalAddress string                 `json:"additional_address"`
	Address           string                 `json:"address"`          // String address to the place (Nevsky, 28)
	CityID            int                    `json:"city_id"`          // City id of address
	CountryID         int                    `json:"country_id"`       // Country id of address
	Distance          int                    `json:"distance"`         // Distance from the point
	ID                int                    `json:"id"`               // Address id
	Latitude          float64                `json:"latitude"`         // Address latitude
	Longitude         float64                `json:"longitude"`        // Address longitude
	MetroStationID    int                    `json:"metro_station_id"` // Metro id of address
	Phone             string                 `json:"phone"`            // Address phone
	TimeOffset        int                    `json:"time_offset"`      // Time offset int minutes from utc time
	Timetable         GroupsAddressTimetable `json:"timetable"`        // Week timetable for the address
	Title             string                 `json:"title"`            // Title of the place (Zinger, etc)
	WorkInfoStatus    string                 `json:"work_info_status"` // Status of information about timetable
	PlaceID           int                    `json:"place_id"`
}

// GroupsAddressTimetable Timetable for a week.
type GroupsAddressTimetable struct {
	Fri GroupsAddressTimetableDay `json:"fri"` // Timetable for friday
	Mon GroupsAddressTimetableDay `json:"mon"` // Timetable for monday
	Sat GroupsAddressTimetableDay `json:"sat"` // Timetable for saturday
	Sun GroupsAddressTimetableDay `json:"sun"` // Timetable for sunday
	Thu GroupsAddressTimetableDay `json:"thu"` // Timetable for thursday
	Tue GroupsAddressTimetableDay `json:"tue"` // Timetable for tuesday
	Wed GroupsAddressTimetableDay `json:"wed"` // Timetable for wednesday
}

// GroupsAddressTimetableDay Timetable for one day.
type GroupsAddressTimetableDay struct {
	BreakCloseTime int `json:"break_close_time"` // Close time of the break in minutes
	BreakOpenTime  int `json:"break_open_time"`  // Start time of the break in minutes
	CloseTime      int `json:"close_time"`       // Close time in minutes
	OpenTime       int `json:"open_time"`        // Open time in minutes
}

// GroupsAddressesInfo struct.
type GroupsAddressesInfo struct {
	IsEnabled     BaseBoolInt `json:"is_enabled"`      // Information whether addresses is enabled
	MainAddressID int         `json:"main_address_id"` // Main address id for group
}

// GroupsGroup AdminLevel type.
const (
	GroupsAdminLevelModerator = iota
	GroupsAdminLevelEditor
	GroupsAdminLevelAdministrator
)

// GroupsGroup MainSection type.
const (
	GroupsMainSectionAbsent = iota
	GroupsMainSectionPhotos
	GroupsMainSectionTopics
	GroupsMainSectionAudio
	GroupsMainSectionVideo
	GroupsMainSectionMarket
)

// GroupsGroup MemberStatus(events_event_attach, newsfeed_event_activity).
const (
	GroupsMemberStatusNotMember = iota
	GroupsMemberStatusMember
	GroupsMemberStatusNotSure
	GroupsMemberStatusDeclined
	GroupsMemberStatusHasSentRequest
	GroupsMemberStatusInvited
)

// GroupsGroup Access or IsClosed type.
const (
	GroupsGroupOpen = iota
	GroupsGroupClosed
	GroupsGroupPrivate
)

// GroupsGroup AgeLimits.
const (
	GroupsAgeLimitsNo = iota
	GroupsAgeLimitsOver16
	GroupsAgeLimitsOver18
)

// GroupsGroup type.
const (
	GroupsTypeGroup = "group"
	GroupsTypePage  = "page"
	GroupsTypeEvent = "event"
)

// GroupsGroup struct.
type GroupsGroup struct {
	ID           int              `json:"id"`          // Community ID
	Name         string           `json:"name"`        // Community name
	ScreenName   string           `json:"screen_name"` // Domain of the community page
	Type         string           `json:"type"`
	IsClosed     int              `json:"is_closed"`
	AdminLevel   int              `json:"admin_level,omitempty"`
	Deactivated  string           `json:"deactivated,omitempty"` // Information whether community is banned
	FinishDate   int              `json:"finish_date,omitempty"` // Finish date in Unixtime format
	Photo100     string           `json:"photo_100,omitempty"`   // URL of square photo of the community with 100 pixels in width
	Photo200     string           `json:"photo_200,omitempty"`   // URL of square photo of the community with 200 pixels in width
	Photo50      string           `json:"photo_50,omitempty"`    // URL of square photo of the community with 50 pixels in width
	StartDate    int              `json:"start_date,omitempty"`  // Start date in Unixtime format
	Market       GroupsMarketInfo `json:"market,omitempty"`
	MemberStatus int              `json:"member_status,omitempty"` // Current user's member status
	City         BaseObject       `json:"city,omitempty"`
	Country      BaseCountry      `json:"country,omitempty"`

	// Information whether current user is administrator.
	IsAdmin BaseBoolInt `json:"is_admin"`

	// Information whether current user is advertiser.
	IsAdvertiser BaseBoolInt `json:"is_advertiser,omitempty"`

	// Information whether current user is member.
	IsMember BaseBoolInt `json:"is_member,omitempty"`

	// Information whether community is in faves.
	IsFavorite BaseBoolInt `json:"is_favorite,omitempty"`

	// Information whether community is adult.
	IsAdult BaseBoolInt `json:"is_adult,omitempty"`

	// Information whether current user is subscribed.
	IsSubscribed BaseBoolInt `json:"is_subscribed,omitempty"`

	// Information whether current user can post on community's wall.
	CanPost BaseBoolInt `json:"can_post,omitempty"`

	// Information whether current user can see all posts on community's wall.
	CanSeeAllPosts BaseBoolInt `json:"can_see_all_posts,omitempty"`

	// Information whether current user can create topic.
	CanCreateTopic BaseBoolInt `json:"can_create_topic,omitempty"`

	// Information whether current user can upload video.
	CanUploadVideo BaseBoolInt `json:"can_upload_video,omitempty"`

	// Information whether current user can upload doc.
	CanUploadDoc BaseBoolInt `json:"can_upload_doc,omitempty"`

	// Information whether community has photo.
	HasPhoto BaseBoolInt `json:"has_photo,omitempty"`

	// Information whether current user can send a message to community.
	CanMessage BaseBoolInt `json:"can_message,omitempty"`

	// Information whether community can send a message to current user.
	IsMessagesBlocked BaseBoolInt `json:"is_messages_blocked,omitempty"`

	// Information whether community can send notifications by phone number to current user.
	CanSendNotify BaseBoolInt `json:"can_send_notify,omitempty"`

	// Information whether current user is subscribed to podcasts.
	IsSubscribedPodcasts BaseBoolInt `json:"is_subscribed_podcasts,omitempty"`

	// Owner in whitelist or not.
	CanSubscribePodcasts BaseBoolInt `json:"can_subscribe_podcasts,omitempty"`

	// Can subscribe to wall.
	CanSubscribePosts BaseBoolInt `json:"can_subscribe_posts,omitempty"`

	// Information whether community has market app.
	HasMarketApp        BaseBoolInt `json:"has_market_app,omitempty"`
	IsHiddenFromFeed    BaseBoolInt `json:"is_hidden_from_feed,omitempty"`
	IsMarketCartEnabled BaseBoolInt `json:"is_market_cart_enabled,omitempty"`
	Verified            BaseBoolInt `json:"verified,omitempty"` // Information whether community is verified

	// Information whether the community has a fire pictogram.
	Trending     BaseBoolInt         `json:"trending,omitempty"`
	Description  string              `json:"description,omitempty"`   // Community description
	WikiPage     string              `json:"wiki_page,omitempty"`     // Community's main wiki page title
	MembersCount int                 `json:"members_count,omitempty"` // Community members number
	Counters     GroupsCountersGroup `json:"counters,omitempty"`
	Cover        GroupsCover         `json:"cover,omitempty"`

	// Type of group, start date of event or category of public page.
	Activity        string               `json:"activity,omitempty"`
	FixedPost       int                  `json:"fixed_post,omitempty"`    // Fixed post ID
	Status          string               `json:"status,omitempty"`        // Community status
	MainAlbumID     int                  `json:"main_album_id,omitempty"` // Community's main photo album ID
	Links           []GroupsLinksItem    `json:"links,omitempty"`
	Contacts        []GroupsContactsItem `json:"contacts,omitempty"`
	Site            string               `json:"site,omitempty"` // Community's website
	MainSection     int                  `json:"main_section,omitempty"`
	OnlineStatus    GroupsOnlineStatus   `json:"online_status,omitempty"` // Status of replies in community messages
	AgeLimits       int                  `json:"age_limits,omitempty"`    // Information whether age limit
	BanInfo         GroupsGroupBanInfo   `json:"ban_info,omitempty"`      // User ban info
	Addresses       GroupsAddressesInfo  `json:"addresses,omitempty"`     // Info about addresses in Groups
	LiveCovers      GroupsLiveCovers     `json:"live_covers,omitempty"`
	CropPhoto       UsersCropPhoto       `json:"crop_photo,omitempty"`
	Wall            int                  `json:"wall,omitempty"`
	ActionButton    GroupsActionButton   `json:"action_button,omitempty"`
	TrackCode       string               `json:"track_code,omitempty"`
	PublicDateLabel string               `json:"public_date_label,omitempty"`
	AuthorID        int                  `json:"author_id,omitempty"`
	Phone           string               `json:"phone,omitempty"`
	Like            GroupsGroupLike      `json:"like"`
}

// ToMention return mention.
func (group GroupsGroup) ToMention() string {
	return fmt.Sprintf("[club%d|%s]", group.ID, group.Name)
}

// GroupsGroupLike struct.
type GroupsGroupLike struct {
	IsLiked BaseBoolInt            `json:"is_liked"`
	Friends GroupsGroupLikeFriends `json:"friends"`
}

// GroupsGroupLikeFriends struct.
type GroupsGroupLikeFriends struct {
	Count   int   `json:"count"`
	Preview []int `json:"preview"`
}

// GroupsLiveCovers struct.
type GroupsLiveCovers struct {
	IsEnabled  BaseBoolInt `json:"is_enabled"`
	IsScalable BaseBoolInt `json:"is_scalable"`
	StoryIds   []string    `json:"story_ids"`
}

// GroupsBanInfo reason type.
const (
	GroupsBanReasonOther = iota
	GroupsBanReasonSpam
	GroupsBanReasonVerbalAbuse
	GroupsBanReasonStrongLanguage
	GroupsBanReasonFlood
)

// GroupsBanInfo struct.
type GroupsBanInfo struct {
	AdminID        int         `json:"admin_id"` // Administrator ID
	Comment        string      `json:"comment"`  // Comment for a ban
	Date           int         `json:"date"`     // Date when user has been added to blacklist in Unixtime
	EndDate        int         `json:"end_date"` // Date when user will be removed from blacklist in Unixtime
	Reason         int         `json:"reason"`
	CommentVisible BaseBoolInt `json:"comment_visible"`
}

// GroupsCallbackServer struct.
type GroupsCallbackServer struct {
	CreatorID int    `json:"creator_id"`
	ID        int    `json:"id"`
	SecretKey string `json:"secret_key"`
	Status    string `json:"status"`
	Title     string `json:"title"`
	URL       string `json:"url"`
}

// GroupsCallbackSettings struct.
type GroupsCallbackSettings struct {
	APIVersion string               `json:"api_version"` // API version used for the events
	Events     GroupsLongPollEvents `json:"events"`
}

// GroupsContactsItem struct.
type GroupsContactsItem struct {
	Desc   string `json:"desc"`    // Contact description
	Email  string `json:"email"`   // Contact email
	Phone  string `json:"phone"`   // Contact phone
	UserID int    `json:"user_id"` // User ID
}

// GroupsCountersGroup struct.
type GroupsCountersGroup struct {
	Addresses      int `json:"addresses"`       // Addresses number
	Albums         int `json:"albums"`          // Photo albums number
	Articles       int `json:"articles"`        // Articles number
	Audios         int `json:"audios"`          // Audios number
	Docs           int `json:"docs"`            // Docs number
	Market         int `json:"market"`          // Market items number
	Photos         int `json:"photos"`          // Photos number
	Topics         int `json:"topics"`          // Topics number
	Videos         int `json:"videos"`          // Videos number
	Narratives     int `json:"narratives"`      // Narratives number
	Clips          int `json:"clips"`           // Clips number
	ClipsFollowers int `json:"clips_followers"` // Clips followers number
}

// UnmarshalJSON GroupsCountersGroup.
//
// BUG(VK): GroupsCountersGroup return [].
func (personal *GroupsCountersGroup) UnmarshalJSON(data []byte) error {
	if bytes.Equal(data, []byte("[]")) {
		return nil
	}

	type renamedGroupsCountersGroup GroupsCountersGroup

	var r renamedGroupsCountersGroup

	err := json.Unmarshal(data, &r)
	if err != nil {
		return err
	}

	*personal = GroupsCountersGroup(r)

	return nil
}

// DecodeMsgpack GroupsCountersGroup.
//
// BUG(VK): GroupsCountersGroup return [].
func (personal *GroupsCountersGroup) DecodeMsgpack(dec *msgpack.Decoder) error {
	data, err := dec.DecodeRaw()
	if err != nil {
		return err
	}

	if bytes.Equal(data, []byte{msgpcode.FixedArrayLow}) {
		return nil
	}

	type renamedGroupsCountersGroup GroupsCountersGroup

	var r renamedGroupsCountersGroup

	d := msgpack.NewDecoder(bytes.NewReader(data))
	d.SetCustomStructTag("json")

	err = d.Decode(&r)
	if err != nil {
		return err
	}

	*personal = GroupsCountersGroup(r)

	return nil
}

// GroupsCover struct.
type GroupsCover struct {
	Enabled BaseBoolInt `json:"enabled"` // Information whether cover is enabled
	Images  []BaseImage `json:"images"`
}

// GroupsGroupBanInfo struct.
type GroupsGroupBanInfo struct {
	Comment string `json:"comment"`  // Ban comment
	EndDate int    `json:"end_date"` // End date of ban in Unixtime
}

// GroupsGroupCategory struct.
type GroupsGroupCategory struct {
	ID            int                  `json:"id"`   // Category ID
	Name          string               `json:"name"` // Category name
	Subcategories []BaseObjectWithName `json:"subcategories"`
}

// GroupsGroupCategoryFull struct.
type GroupsGroupCategoryFull struct {
	ID            int                       `json:"id"`         // Category ID
	Name          string                    `json:"name"`       // Category name
	PageCount     int                       `json:"page_count"` // Pages number
	PagePreviews  []GroupsGroup             `json:"page_previews"`
	Subcategories []GroupsGroupCategoryFull `json:"subcategories"`
}

// GroupsGroupCategoryType struct.
type GroupsGroupCategoryType struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

// GroupsGroupLink struct.
type GroupsGroupLink struct {
	Desc            string      `json:"desc"`             // Link description
	EditTitle       BaseBoolInt `json:"edit_title"`       // Information whether the title can be edited
	ImageProcessing BaseBoolInt `json:"image_processing"` // Information whether the image on processing
	Name            string      `json:"name"`
	ID              int         `json:"id"`  // Link ID
	URL             string      `json:"url"` // Link URL
}

// GroupsGroupPublicCategoryList struct.
type GroupsGroupPublicCategoryList struct {
	ID            int                       `json:"id"`
	Name          string                    `json:"name"`
	Subcategories []GroupsGroupCategoryType `json:"subcategories"`
}

// GroupsGroupSettings Photos type.
const (
	GroupsGroupPhotosDisabled = iota
	GroupsGroupPhotosOpen
	GroupsGroupPhotosLimited
)

// GroupsGroupSettings Subject type.
const (
	_ = iota
	GroupsGroupSubjectAuto
	GroupsGroupSubjectActivityHolidays
	GroupsGroupSubjectBusiness
	GroupsGroupSubjectPets
	GroupsGroupSubjectHealth
	GroupsGroupSubjectDatingAndCommunication
	GroupsGroupSubjectGames
	GroupsGroupSubjectIt
	GroupsGroupSubjectCinema
	GroupsGroupSubjectBeautyAndFashion
	GroupsGroupSubjectCooking
	GroupsGroupSubjectArtAndCulture
	GroupsGroupSubjectLiterature
	GroupsGroupSubjectMobileServicesAndInternet
	GroupsGroupSubjectMusic
	GroupsGroupSubjectScienceAndTechnology
	GroupsGroupSubjectRealEstate
	GroupsGroupSubjectNewsAndMedia
	GroupsGroupSubjectSecurity
	GroupsGroupSubjectEducation
	GroupsGroupSubjectHomeAndRenovations
	GroupsGroupSubjectPolitics
	GroupsGroupSubjectFood
	GroupsGroupSubjectIndustry
	GroupsGroupSubjectTravel
	GroupsGroupSubjectWork
	GroupsGroupSubjectEntertainment
	GroupsGroupSubjectReligion
	GroupsGroupSubjectFamily
	GroupsGroupSubjectSports
	GroupsGroupSubjectInsurance
	GroupsGroupSubjectTelevision
	GroupsGroupSubjectGoodsAndServices
	GroupsGroupSubjectHobbies
	GroupsGroupSubjectFinance
	GroupsGroupSubjectPhoto
	GroupsGroupSubjectEsoterics
	GroupsGroupSubjectElectronicsAndAppliances
	GroupsGroupSubjectErotic
	GroupsGroupSubjectHumor
	GroupsGroupSubjectSocietyHumanities
	GroupsGroupSubjectDesignAndGraphics
)

// GroupsGroupSettings Topics type.
const (
	GroupsGroupTopicsDisabled = iota
	GroupsGroupTopicsOpen
	GroupsGroupTopicsLimited
)

// GroupsGroupSettings Docs type.
const (
	GroupsGroupDocsDisabled = iota
	GroupsGroupDocsOpen
	GroupsGroupDocsLimited
)

// GroupsGroupSettings Audio type.
const (
	GroupsGroupAudioDisabled = iota
	GroupsGroupAudioOpen
	GroupsGroupAudioLimited
)

// GroupsGroupSettings Video type.
const (
	GroupsGroupVideoDisabled = iota
	GroupsGroupVideoOpen
	GroupsGroupVideoLimited
)

// GroupsGroupSettings Wall type.
const (
	GroupsGroupWallDisabled = iota
	GroupsGroupWallOpen
	GroupsGroupWallLimited
	GroupsGroupWallClosed
)

// GroupsGroupSettings Wiki type.
const (
	GroupsGroupWikiDisabled = iota
	GroupsGroupWikiOpen
	GroupsGroupWikiLimited
)

// GroupsGroupSettings struct.
type GroupsGroupSettings struct {
	Access             int                             `json:"access"`          // Community access settings
	Address            string                          `json:"address"`         // Community's page domain
	Audio              int                             `json:"audio"`           // Audio settings
	Description        string                          `json:"description"`     // Community description
	Docs               int                             `json:"docs"`            // Docs settings
	ObsceneWords       []string                        `json:"obscene_words"`   // The list of stop words
	Photos             int                             `json:"photos"`          // Photos settings
	PublicCategory     int                             `json:"public_category"` // Information about the group category
	PublicCategoryList []GroupsGroupPublicCategoryList `json:"public_category_list"`

	// Information about the group subcategory.
	PublicSubcategory int                 `json:"public_subcategory"`
	Rss               string              `json:"rss"`     // URL of the RSS feed
	Subject           int                 `json:"subject"` // Community subject ID
	SubjectList       []GroupsSubjectItem `json:"subject_list"`
	Title             string              `json:"title"`   // Community title
	Topics            int                 `json:"topics"`  // Topics settings
	Video             int                 `json:"video"`   // Video settings
	Wall              int                 `json:"wall"`    // Wall settings
	Website           string              `json:"website"` // Community website
	Wiki              int                 `json:"wiki"`    // Wiki settings
	CountryID         int                 `json:"country_id"`
	CityID            int                 `json:"city_id"`
	Messages          int                 `json:"messages"`
	Articles          int                 `json:"articles"`
	Events            int                 `json:"events"`
	AgeLimits         int                 `json:"age_limits"`

	// Information whether the obscene filter is enabled.
	ObsceneFilter BaseBoolInt `json:"obscene_filter"`

	// Information whether the stopwords filter is enabled.
	ObsceneStopwords BaseBoolInt `json:"obscene_stopwords"`
	LiveCovers       struct {
		IsEnabled BaseBoolInt `json:"is_enabled"`
	} `json:"live_covers"`
	Market           GroupsMarketInfo     `json:"market"`
	SectionsList     []GroupsSectionsList `json:"sections_list"`
	MainSection      int                  `json:"main_section"`
	SecondarySection int                  `json:"secondary_section"`
	ActionButton     GroupsActionButton   `json:"action_button"`
	Phone            string               `json:"phone"`

	RecognizePhoto int `json:"recognize_photo"`

	MarketServices GroupsMarketServices `json:"market_services"`
	Narratives     int                  `json:"narratives"`
	Clips          int                  `json:"clips"`
	Textlives      int                  `json:"textlives"`
	Youla          GroupsYoula          `json:"youla"`
}

// GroupsMarketServices struct.
type GroupsMarketServices struct {
	Enabled         BaseBoolInt         `json:"enabled"`
	CanMessage      BaseBoolInt         `json:"can_message"`
	CommentsEnabled BaseBoolInt         `json:"comments_enabled"`
	ContactID       int                 `json:"contact_id"`
	Currency        MarketCurrency      `json:"currency"`
	ViewType        GroupsSelectedItems `json:"view_type"`
	BlockName       GroupsSelectedItems `json:"block_name"`
	ButtonLabel     GroupsSelectedItems `json:"button_label"`
}

// GroupsSelectedItems struct.
type GroupsSelectedItems struct {
	SelectedItemID int64                `json:"selected_item_id"`
	Items          []BaseObjectWithName `json:"items"`
}

// GroupsYoula struct.
type GroupsYoula struct {
	CategoryTree  GroupsYoulaCategory `json:"category_tree"`
	GroupSettings GroupsYoulaSettings `json:"group_settings"`
}

// GroupsYoulaCategory struct.
type GroupsYoulaCategory struct {
	ID            int                      `json:"id"`
	Title         string                   `json:"title"`
	Subcategories []GroupsYoulaSubcategory `json:"subcategories"`
}

// GroupsYoulaSubcategory struct.
type GroupsYoulaSubcategory struct {
	ID            int                      `json:"id"`
	Title         string                   `json:"title"`
	ParentID      int                      `json:"parent_id"`
	Subcategories []GroupsYoulaSubcategory `json:"subcategories"`
}

// GroupsYoulaSettings struct.
type GroupsYoulaSettings struct {
	IsActive              BaseBoolInt `json:"is_active"`
	IsModerated           BaseBoolInt `json:"is_moderated"`
	ShowModerationSetting BaseBoolInt `json:"show_moderation_setting"`
	ModerationStatus      int         `json:"moderation_status"`
	DeclineReason         string      `json:"decline_reason"`
	GroupMode             int         `json:"group_mode"`
	SelectedCategoryIDS   []int       `json:"selected_category_ids"`
	Lat                   float64     `json:"lat"`
	Long                  float64     `json:"long"`
	Radius                float64     `json:"radius"`
	RadiusArea            string      `json:"radius_area"`
	Address               string      `json:"address"`
	Radiuses              []float64   `json:"radiuses"`
}

// GroupsSectionsList struct.
type GroupsSectionsList struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

// UnmarshalJSON need for unmarshal dynamic array (Example: [1, "Фотографии"]) to struct.
//
// To unmarshal JSON into a value implementing the Unmarshaler interface,
// Unmarshal calls that value's UnmarshalJSON method.
// See more https://golang.org/pkg/encoding/json/#Unmarshal
func (g *GroupsSectionsList) UnmarshalJSON(data []byte) error {
	var alias []interface{}
	if err := json.Unmarshal(data, &alias); err != nil {
		return err
	}

	if len(alias) != 2 {
		return &json.UnmarshalTypeError{
			Value: string(data),
			Type:  reflect.TypeOf((*GroupsSectionsList)(nil)),
		}
	}

	// default concrete Go type float64 for JSON numbers
	id, ok := alias[0].(float64)
	if !ok {
		return &json.UnmarshalTypeError{
			Value:  string(data),
			Type:   reflect.TypeOf((*GroupsSectionsList)(nil)),
			Struct: "GroupsSectionsList",
			Field:  "ID",
		}
	}

	name, ok := alias[1].(string)
	if !ok {
		return &json.UnmarshalTypeError{
			Value:  string(data),
			Type:   reflect.TypeOf((*GroupsSectionsList)(nil)),
			Struct: "GroupsSectionsList",
			Field:  "Name",
		}
	}

	g.ID = int(id)
	g.Name = name

	return nil
}

// DecodeMsgpack need for decode dynamic array (Example: [1, "Фотографии"]) to struct.
func (g *GroupsSectionsList) DecodeMsgpack(dec *msgpack.Decoder) error {
	data, err := dec.DecodeRaw()
	if err != nil {
		return err
	}

	var alias []interface{}

	err = msgpack.Unmarshal(data, &alias)
	if err != nil {
		return err
	}

	if len(alias) != 2 {
		return &json.UnmarshalTypeError{
			Value: string(data),
			Type:  reflect.TypeOf((*GroupsSectionsList)(nil)),
		}
	}

	id, ok := alias[0].(int8)
	if !ok {
		return &json.UnmarshalTypeError{
			Value:  string(data),
			Type:   reflect.TypeOf((*GroupsSectionsList)(nil)),
			Struct: "GroupsSectionsList",
			Field:  "ID",
		}
	}

	name, ok := alias[1].(string)
	if !ok {
		return &json.UnmarshalTypeError{
			Value:  string(data),
			Type:   reflect.TypeOf((*GroupsSectionsList)(nil)),
			Struct: "GroupsSectionsList",
			Field:  "Name",
		}
	}

	g.ID = int(id)
	g.Name = name

	return nil
}

// GroupsActionType for action_button in groups.
type GroupsActionType string

// GroupsActionType enums.
const (
	GroupsActionTypeOpenURL      GroupsActionType = "open_url"
	GroupsActionTypeSendEmail    GroupsActionType = "send_email"
	GroupsActionTypeCallPhone    GroupsActionType = "call_phone"
	GroupsActionTypeCallVK       GroupsActionType = "call_vk"
	GroupsActionTypeOpenGroupApp GroupsActionType = "open_group_app"
	GroupsActionTypeOpenApp      GroupsActionType = "open_app"
)

// GroupsActionButton struct.
type GroupsActionButton struct {
	ActionType GroupsActionType         `json:"action_type"`
	Target     GroupsActionButtonTarget `json:"target"`
	Title      string                   `json:"title"`

	// IsEnabled for GroupsGroupSettings
	IsEnabled BaseBoolInt `json:"is_enabled,omitempty"`
}

// GroupsActionButtonTarget struct.
type GroupsActionButtonTarget struct {
	// ActionType == ActionTypeSendEmail
	Email string `json:"email"`

	// ActionType == ActionTypeCallPhone
	Phone string `json:"phone"`

	// ActionType == ActionTypeCallVK
	UserID int `json:"user_id"`

	// ActionType == ActionTypeOpenURL
	URL string `json:"url"`

	// ActionType == ActionTypeOpenApp
	GoogleStoreURL string `json:"google_store_url"`
	ItunesURL      string `json:"itunes_url"`
	// URL string `json:"url"`

	// ActionType == ActionTypeOpenGroupApp
	AppID int `json:"app_id"`

	IsInternal BaseBoolInt `json:"is_internal"`
}

// GroupsGroupXtrInvitedBy struct.
type GroupsGroupXtrInvitedBy struct {
	AdminLevel   int         `json:"admin_level"`
	ID           int         `json:"id"`          // Community ID
	InvitedBy    int         `json:"invited_by"`  // Inviter ID
	Name         string      `json:"name"`        // Community name
	Photo100     string      `json:"photo_100"`   // URL of square photo of the community with 100 pixels in width
	Photo200     string      `json:"photo_200"`   // URL of square photo of the community with 200 pixels in width
	Photo50      string      `json:"photo_50"`    // URL of square photo of the community with 50 pixels in width
	ScreenName   string      `json:"screen_name"` // Domain of the community page
	Type         string      `json:"type"`
	IsClosed     int         `json:"is_closed"`     // Information whether community is closed
	IsAdmin      BaseBoolInt `json:"is_admin"`      // Information whether current user is manager
	IsMember     BaseBoolInt `json:"is_member"`     // Information whether current user is member
	IsAdvertiser BaseBoolInt `json:"is_advertiser"` // Information whether current user is advertiser
}

// ToMention return mention.
func (group GroupsGroupXtrInvitedBy) ToMention() string {
	return fmt.Sprintf("[club%d|%s]", group.ID, group.Name)
}

// GroupsLinksItem struct.
type GroupsLinksItem struct {
	Desc      string      `json:"desc"`       // Link description
	EditTitle BaseBoolInt `json:"edit_title"` // Information whether the link title can be edited
	ID        int         `json:"id"`         // Link ID
	Name      string      `json:"name"`       // Link title
	Photo100  string      `json:"photo_100"`  // URL of square image of the link with 100 pixels in width
	Photo50   string      `json:"photo_50"`   // URL of square image of the link with 50 pixels in width
	URL       string      `json:"url"`        // Link URL
}

// GroupsLongPollEvents struct.
type GroupsLongPollEvents struct {
	MessageNew                    BaseBoolInt `json:"message_new"`
	MessageReply                  BaseBoolInt `json:"message_reply"`
	PhotoNew                      BaseBoolInt `json:"photo_new"`
	AudioNew                      BaseBoolInt `json:"audio_new"`
	VideoNew                      BaseBoolInt `json:"video_new"`
	WallReplyNew                  BaseBoolInt `json:"wall_reply_new"`
	WallReplyEdit                 BaseBoolInt `json:"wall_reply_edit"`
	WallReplyDelete               BaseBoolInt `json:"wall_reply_delete"`
	WallReplyRestore              BaseBoolInt `json:"wall_reply_restore"`
	WallPostNew                   BaseBoolInt `json:"wall_post_new"`
	BoardPostNew                  BaseBoolInt `json:"board_post_new"`
	BoardPostEdit                 BaseBoolInt `json:"board_post_edit"`
	BoardPostRestore              BaseBoolInt `json:"board_post_restore"`
	BoardPostDelete               BaseBoolInt `json:"board_post_delete"`
	PhotoCommentNew               BaseBoolInt `json:"photo_comment_new"`
	PhotoCommentEdit              BaseBoolInt `json:"photo_comment_edit"`
	PhotoCommentDelete            BaseBoolInt `json:"photo_comment_delete"`
	PhotoCommentRestore           BaseBoolInt `json:"photo_comment_restore"`
	VideoCommentNew               BaseBoolInt `json:"video_comment_new"`
	VideoCommentEdit              BaseBoolInt `json:"video_comment_edit"`
	VideoCommentDelete            BaseBoolInt `json:"video_comment_delete"`
	VideoCommentRestore           BaseBoolInt `json:"video_comment_restore"`
	MarketCommentNew              BaseBoolInt `json:"market_comment_new"`
	MarketCommentEdit             BaseBoolInt `json:"market_comment_edit"`
	MarketCommentDelete           BaseBoolInt `json:"market_comment_delete"`
	MarketCommentRestore          BaseBoolInt `json:"market_comment_restore"`
	MarketOrderNew                BaseBoolInt `json:"market_order_new"`
	MarketOrderEdit               BaseBoolInt `json:"market_order_edit"`
	PollVoteNew                   BaseBoolInt `json:"poll_vote_new"`
	GroupJoin                     BaseBoolInt `json:"group_join"`
	GroupLeave                    BaseBoolInt `json:"group_leave"`
	GroupChangeSettings           BaseBoolInt `json:"group_change_settings"`
	GroupChangePhoto              BaseBoolInt `json:"group_change_photo"`
	GroupOfficersEdit             BaseBoolInt `json:"group_officers_edit"`
	MessageAllow                  BaseBoolInt `json:"message_allow"`
	MessageDeny                   BaseBoolInt `json:"message_deny"`
	WallRepost                    BaseBoolInt `json:"wall_repost"`
	UserBlock                     BaseBoolInt `json:"user_block"`
	UserUnblock                   BaseBoolInt `json:"user_unblock"`
	MessageEdit                   BaseBoolInt `json:"message_edit"`
	MessageTypingState            BaseBoolInt `json:"message_typing_state"`
	LeadFormsNew                  BaseBoolInt `json:"lead_forms_new"`
	LikeAdd                       BaseBoolInt `json:"like_add"`
	LikeRemove                    BaseBoolInt `json:"like_remove"`
	VkpayTransaction              BaseBoolInt `json:"vkpay_transaction"`
	AppPayload                    BaseBoolInt `json:"app_payload"`
	MessageRead                   BaseBoolInt `json:"message_read"`
	MessageEvent                  BaseBoolInt `json:"message_event"`
	DonutSubscriptionCreate       BaseBoolInt `json:"donut_subscription_create"`
	DonutSubscriptionProlonged    BaseBoolInt `json:"donut_subscription_prolonged"`
	DonutSubscriptionExpired      BaseBoolInt `json:"donut_subscription_expired"`
	DonutSubscriptionCancelled    BaseBoolInt `json:"donut_subscription_cancelled"`
	DonutSubscriptionPriceChanged BaseBoolInt `json:"donut_subscription_price_changed"`
	DonutMoneyWithdraw            BaseBoolInt `json:"donut_money_withdraw"`
	DonutMoneyWithdrawError       BaseBoolInt `json:"donut_money_withdraw_error"`

	// Bugs
	// MessagesEdit  BaseBoolInt `json:"messages_edit"`
	// WallNew       BaseBoolInt `json:"wall_new"`
	// WallNewReply  BaseBoolInt `json:"wall_new_reply"`
	// WallEditReply BaseBoolInt `json:"wall_edit_reply"`
}

// GroupsLongPollServer struct.
type GroupsLongPollServer struct {
	Key    string `json:"key"`    // Long Poll key
	Server string `json:"server"` // Long Poll server address
	Ts     string `json:"ts"`     // Number of the last event
}

// GetURL return link.
func (lp GroupsLongPollServer) GetURL(wait int) string {
	return fmt.Sprintf("%s?act=a_check&key=%s&ts=%s&wait=%d", lp.Server, lp.Key, lp.Ts, wait)
}

// GroupsLongPollSettings struct.
type GroupsLongPollSettings struct {
	APIVersion string               `json:"api_version"` // API version used for the events
	Events     GroupsLongPollEvents `json:"events"`
	IsEnabled  BaseBoolInt          `json:"is_enabled"` // Shows whether Long Poll is enabled
}

// GroupsMarketType ...
type GroupsMarketType string

// Possible values.
const (
	GroupsMarketBasic    GroupsMarketType = "basic"
	GroupsMarketAdvanced GroupsMarketType = "advanced"
)

// GroupsMarketInfo struct.
type GroupsMarketInfo struct {
	// information about the type of store. Returned if the group includes
	// the "Products" section.
	Type            GroupsMarketType  `json:"type,omitempty"`
	ContactID       int               `json:"contact_id,omitempty"` // Contact person ID
	Currency        MarketCurrency    `json:"currency,omitempty"`
	CurrencyText    string            `json:"currency_text,omitempty"` // Currency name
	Enabled         BaseBoolInt       `json:"enabled"`                 // Information whether the market is enabled
	CommentsEnabled BaseBoolInt       `json:"comments_enabled,omitempty"`
	CanMessage      BaseBoolInt       `json:"can_message,omitempty"`
	IsHsEnabled     BaseBoolInt       `json:"is_hs_enabled,omitempty"`
	MainAlbumID     int               `json:"main_album_id,omitempty"` // Main market album ID
	PriceMax        string            `json:"price_max,omitempty"`     // Maximum price
	PriceMin        string            `json:"price_min,omitempty"`     // Minimum price
	Wiki            PagesWikipageFull `json:"wiki,omitempty"`
	CityIDs         []int             `json:"city_ids"`
	CountryIDs      []int             `json:"country_ids,omitempty"`
	MinOrderPrice   MarketPrice       `json:"min_order_price,omitempty"`
}

// GroupsGroupRole Role type.
const (
	GroupsGroupRoleModerator     = "moderator"
	GroupsGroupRoleEditor        = "editor"
	GroupsGroupRoleAdministrator = "administrator"
	GroupsGroupRoleCreator       = "creator"
)

// GroupsMemberRole struct.
type GroupsMemberRole struct {
	ID          int      `json:"id"` // User ID
	Role        string   `json:"role"`
	Permissions []string `json:"permissions"`
}

// GroupsMemberRoleXtrUsersUser struct.
type GroupsMemberRoleXtrUsersUser struct {
	UsersUser
	Role        string   `json:"role"`
	Permissions []string `json:"permissions"`
}

// GroupsMemberStatus struct.
type GroupsMemberStatus struct {
	Member      BaseBoolInt `json:"member"`  // Information whether user is a member of the group
	UserID      int         `json:"user_id"` // User ID
	Permissions []string    `json:"permissions"`
}

// GroupsMemberStatusFull struct.
type GroupsMemberStatusFull struct {
	Invitation BaseBoolInt `json:"invitation"` // Information whether user has been invited to the group
	Member     BaseBoolInt `json:"member"`     // Information whether user is a member of the group
	Request    BaseBoolInt `json:"request"`    // Information whether user has send request to the group
	CanInvite  BaseBoolInt `json:"can_invite"` // Information whether user can be invite
	CanRecall  BaseBoolInt `json:"can_recall"` // Information whether user's invite to the group can be recalled
	UserID     int         `json:"user_id"`    // User ID
}

// GroupsOnlineStatus Status type.
const (
	GroupsOnlineStatusTypeNone       = "none"
	GroupsOnlineStatusTypeOnline     = "online"
	GroupsOnlineStatusTypeAnswerMark = "answer_mark"
)

// GroupsOnlineStatus struct.
type GroupsOnlineStatus struct {
	Minutes int    `json:"minutes"` // Estimated time of answer (for status = answer_mark)
	Status  string `json:"status"`
}

// GroupsOwnerXtrBanInfo struct.
type GroupsOwnerXtrBanInfo struct {
	BanInfo GroupsBanInfo `json:"ban_info"`
	Group   GroupsGroup   `json:"group"`
	Profile UsersUser     `json:"profile"`
	Type    string        `json:"type"`
}

// GroupsSubjectItem struct.
type GroupsSubjectItem struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

// GroupsTokenPermissionSetting struct.
type GroupsTokenPermissionSetting struct {
	Name    string `json:"name"`
	Setting int    `json:"setting"`
}

// GroupsTokenPermissions struct.
type GroupsTokenPermissions struct {
	Mask        int                            `json:"mask"`
	Permissions []GroupsTokenPermissionSetting `json:"permissions"`
}

// GroupsTag struct.
type GroupsTag struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}