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