1 package com.atlassian.marketplace.client.model;
2
3 import com.atlassian.fugue.Option;
4
5 import com.google.common.collect.ImmutableList;
6
7 import org.joda.time.DateTime;
8
9 /**
10 * Information about the pricing of a paid-via-Atlassian add-on.
11 * @since 2.0.0
12 */
13 public class AddonPricing
14 {
15 @ReadOnly Links _links;
16 ImmutableList<AddonPricingItem> items;
17 Boolean expertDiscountOptOut;
18 Boolean contactSalesForAdditionalPricing;
19 Option<String> parent;
20 @ReadOnly Option<DateTime> lastModified;
21 Option<RoleInfo> role;
22
23 public Links getLinks()
24 {
25 return _links;
26 }
27
28 /**
29 * A list of available pricing tiers.
30 */
31 public Iterable<AddonPricingItem> getItems()
32 {
33 return items;
34 }
35
36 /**
37 * True if Atlassian Experts <i>cannot</i> purchase the add-on at a discount.
38 */
39 public boolean isExpertDiscountOptOut()
40 {
41 return expertDiscountOptOut;
42 }
43
44 /**
45 * True if the vendor can be contacted for additional pricing.
46 */
47 public boolean isContactSalesForAdditionalPricing()
48 {
49 return contactSalesForAdditionalPricing;
50 }
51
52 /**
53 * Key of the application that the add-on is for (e.g. "jira").
54 */
55 public Option<String> getParent()
56 {
57 return parent;
58 }
59
60 /**
61 * Timestamp of the last change made to this pricing.
62 */
63 public Option<DateTime> getLastModified()
64 {
65 return lastModified;
66 }
67
68 /**
69 * Returns true if the pricing is role-based, false if not (e.g. user-tiered).
70 */
71 public boolean isRoleBased()
72 {
73 return getRoleInfo().isDefined();
74 }
75
76 /**
77 * Additional information describing the pricing role for a role-based plugin.
78 * <p>
79 * Will only be set for role-based plugins; user-tiered plugins will not have any value set.
80 */
81 public Option<RoleInfo> getRoleInfo()
82 {
83 return role;
84 }
85
86 /**
87 * Additional information describing the pricing role for a role-based plugin.
88 */
89 public static class RoleInfo
90 {
91 String singularName;
92 String pluralName;
93
94 /**
95 * The singular form of the pricing role name, such as "user".
96 * <p>
97 * The name should be in American English.
98 */
99 public String getSingularName()
100 {
101 return singularName;
102 }
103
104 /**
105 * The plural form of the pricing role name, such as "users".
106 * <p>
107 * The name should be in American English.
108 */
109 public String getPluralName()
110 {
111 return pluralName;
112 }
113 }
114 }