001/* 002 * Copyright 2017 RedRoma, Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package tech.aroma.client; 018 019import tech.aroma.thrift.Urgency; 020import tech.sirwellington.alchemy.annotations.arguments.Required; 021import tech.sirwellington.alchemy.arguments.assertions.Assertions; 022 023import static tech.sirwellington.alchemy.arguments.Arguments.*; 024 025/* 026 * This class exists to give some Schema Isolation to Clients from any changes that happen in the Thrift Specification. 027 */ 028 029/** 030 * Describes how important a message is. 031 * 032 * @author SirWellington 033 */ 034public enum Priority 035{ 036 037 /** 038 * LOW Messages are like an FYI; they are not important but you may want to know 039 * about it. For example, a new user sign-up for your service, or a post was flagged by a user. 040 */ 041 LOW(Urgency.LOW), 042 043 /** 044 * MEDIUM Messages are considered Important. 045 */ 046 MEDIUM(Urgency.MEDIUM), 047 048 /** 049 * HIGH messages typically indicate Show-Stopping events, such as a Database going down, 050 * or a network connection issue. It could also be a great thing, such as a customer spending a 051 * significant amount of money in your App. 052 */ 053 HIGH(Urgency.HIGH); 054 055 private final Urgency thriftUrgency; 056 057 private Priority(@Required Urgency thriftUrgency) 058 { 059 checkThat(thriftUrgency).is(Assertions.<Urgency>notNull()); 060 061 this.thriftUrgency = thriftUrgency; 062 } 063 064 /** 065 * Map to the underlying Thrift version. 066 * 067 * @return 068 */ 069 Urgency toThrift() 070 { 071 return thriftUrgency; 072 } 073}