001/*
002 * Copyright 2010-2013 Ning, Inc.
003 *
004 * Ning licenses this file to you under the Apache License, version 2.0
005 * (the "License"); you may not use this file except in compliance with the
006 * License.  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, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
013 * License for the specific language governing permissions and limitations
014 * under the License.
015 */
016
017package com.ning.billing.recurly.model;
018
019import javax.xml.bind.annotation.XmlRootElement;
020import javax.xml.bind.annotation.XmlTransient;
021
022import com.fasterxml.jackson.annotation.JsonIgnore;
023import com.fasterxml.jackson.annotation.JsonSetter;
024
025@XmlRootElement(name = "adjustments")
026public class Adjustments extends RecurlyObjects<Adjustment> {
027
028    @XmlTransient
029    public static final String ADJUSTMENTS_RESOURCE = "/adjustments";
030
031    @XmlTransient
032    private static final String PROPERTY_NAME = "adjustment";
033
034    @JsonSetter(value = PROPERTY_NAME)
035    @Override
036    public void setRecurlyObject(final Adjustment value) {
037        super.setRecurlyObject(value);
038    }
039
040    public enum AdjustmentType {
041        CHARGE("charge"),
042        CREDIT("credit");
043
044        private final String type;
045
046        private AdjustmentType(final String type) {
047            this.type = type;
048        }
049
050        public String getType() {
051            return type;
052        }
053    }
054
055    public enum AdjustmentState {
056        PENDING("pending"),
057        INVOICED("invoiced");
058
059        private final String state;
060
061        private AdjustmentState(final String state) {
062            this.state = state;
063        }
064
065        public String getState() {
066            return state;
067        }
068    }
069
070    @JsonIgnore
071    public Adjustments getStart() {
072        return getStart(Adjustments.class);
073    }
074
075    @JsonIgnore
076    public Adjustments getPrev() {
077        return getPrev(Adjustments.class);
078    }
079
080    @JsonIgnore
081    public Adjustments getNext() {
082        return getNext(Adjustments.class);
083    }
084}