|
| 1 | +package com.iab.gdpr.consent; |
| 2 | + |
| 3 | +import java.time.Instant; |
| 4 | +import java.util.Set; |
| 5 | + |
| 6 | +/** |
| 7 | + * Representation of the values in the vendor consent string. |
| 8 | + * |
| 9 | + * Combination of {@link VendorConsent#isPurposeAllowed(int)} and {@link VendorConsent#isVendorAllowed(int)} methods |
| 10 | + * fully describes user's consent for particular action by a particular vendor |
| 11 | + * |
| 12 | + */ |
| 13 | +public interface VendorConsent { |
| 14 | + |
| 15 | + /** |
| 16 | + * |
| 17 | + * @return the version of consent string format |
| 18 | + */ |
| 19 | + int getVersion(); |
| 20 | + |
| 21 | + /** |
| 22 | + * @return the {@link Instant} at which the consent string was created |
| 23 | + */ |
| 24 | + Instant getConsentRecordCreated(); |
| 25 | + |
| 26 | + /** |
| 27 | + * |
| 28 | + * @return the {@link Instant} at which consent string was last updated |
| 29 | + */ |
| 30 | + Instant getConsentRecordLastUpdated(); |
| 31 | + |
| 32 | + /** |
| 33 | + * |
| 34 | + * @return the Consent Manager Provider ID that last updated the consent string |
| 35 | + */ |
| 36 | + int getCmpId(); |
| 37 | + |
| 38 | + /** |
| 39 | + * |
| 40 | + * @return the Consent Manager Provider version |
| 41 | + */ |
| 42 | + int getCmpVersion(); |
| 43 | + |
| 44 | + /** |
| 45 | + * |
| 46 | + * @return the screen number in the CMP where consent was given |
| 47 | + */ |
| 48 | + int getConsentScreen(); |
| 49 | + |
| 50 | + /** |
| 51 | + * |
| 52 | + * @return the two-letter ISO639-1 language code that CMP asked for consent in |
| 53 | + */ |
| 54 | + String getConsentLanguage(); |
| 55 | + |
| 56 | + /** |
| 57 | + * |
| 58 | + * @return version of vendor list used in most recent consent string update. |
| 59 | + */ |
| 60 | + int getVendorListVersion(); |
| 61 | + |
| 62 | + /** |
| 63 | + * |
| 64 | + * @return the set of purpose id's which are permitted according to this consent string |
| 65 | + */ |
| 66 | + Set<Integer> getAllowedPurposes(); |
| 67 | + |
| 68 | + /** |
| 69 | + * |
| 70 | + * @return an integer equivalent of allowed purpose id bits according to this consent string |
| 71 | + */ |
| 72 | + int getAllowedPurposesBits(); |
| 73 | + |
| 74 | + /** |
| 75 | + * |
| 76 | + * @return the maximum VendorId for which consent values are given. |
| 77 | + */ |
| 78 | + int getMaxVendorId(); |
| 79 | + |
| 80 | + /** |
| 81 | + * Check whether purpose with specified ID is allowed |
| 82 | + * @param purposeId purpose ID |
| 83 | + * @return true if purpose is allowed in this consent, false otherwise |
| 84 | + */ |
| 85 | + boolean isPurposeAllowed(int purposeId); |
| 86 | + |
| 87 | + /** |
| 88 | + * Check whether vendor with specified ID is allowd |
| 89 | + * @param vendorId vendor ID |
| 90 | + * @return a boolean describing if a user has consented to a particular vendor |
| 91 | + */ |
| 92 | + boolean isVendorAllowed(int vendorId); |
| 93 | + |
| 94 | + /** |
| 95 | + * |
| 96 | + * @return the value of this consent as byte array |
| 97 | + */ |
| 98 | + byte[] toByteArray(); |
| 99 | + |
| 100 | +} |
0 commit comments