001/*
002 * Copyright (c) 2011-2018 Nexmo Inc
003 *
004 * Permission is hereby granted, free of charge, to any person obtaining a copy
005 * of this software and associated documentation files (the "Software"), to deal
006 * in the Software without restriction, including without limitation the rights
007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008 * copies of the Software, and to permit persons to whom the Software is
009 * furnished to do so, subject to the following conditions:
010 *
011 * The above copyright notice and this permission notice shall be included in
012 * all copies or substantial portions of the Software.
013 *
014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
020 * THE SOFTWARE.
021 */
022package com.nexmo.client.verify;
023
024import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
025import com.fasterxml.jackson.annotation.JsonProperty;
026import com.fasterxml.jackson.annotation.JsonValue;
027
028import java.math.BigDecimal;
029import java.util.*;
030
031@JsonIgnoreProperties(ignoreUnknown = true)
032public class VerifyDetails {
033
034    private String requestId;
035    private String accountId;
036    private String number;
037    private String senderId;
038    private Date dateSubmitted;
039    private Date dateFinalized;
040    private Date firstEventDate;
041    private Date lastEventDate;
042    private Status status;
043    private BigDecimal price;
044    private String currency;
045    private List<VerifyCheck> checks = new ArrayList<>();
046
047    @JsonProperty("request_id")
048    public String getRequestId() {
049        return this.requestId;
050    }
051
052    @JsonProperty("account_id")
053    public String getAccountId() {
054        return this.accountId;
055    }
056
057    public String getNumber() {
058        return this.number;
059    }
060
061    @JsonProperty("sender_id")
062    public String getSenderId() {
063        return this.senderId;
064    }
065
066    @JsonProperty("date_submitted")
067    public Date getDateSubmitted() {
068        return this.dateSubmitted;
069    }
070
071    @JsonProperty("date_finalized")
072    public Date getDateFinalized() {
073        return this.dateFinalized;
074    }
075
076    @JsonProperty("first_event_date")
077    public Date getFirstEventDate() {
078        return this.firstEventDate;
079    }
080
081    @JsonProperty("last_event_date")
082    public Date getLastEventDate() {
083        return this.lastEventDate;
084    }
085
086    public Status getStatus() {
087        return this.status;
088    }
089
090    public BigDecimal getPrice() {
091        return this.price;
092    }
093
094    public String getCurrency() {
095        return this.currency;
096    }
097
098    public List<VerifyCheck> getChecks() {
099        return this.checks;
100    }
101
102    public enum Status {
103        IN_PROGRESS("IN PROGRESS"),
104        SUCCESS("SUCCESS"),
105        FAILED("FAILED"),
106        EXPIRED("EXPIRED"),
107        CANCELLED("CANCELLED"),
108        INVALID("101");
109
110        private String status;
111
112        private static Map<String, Status> stringStatusValues = new HashMap<>();
113
114        static {
115            for (Status status : Status.values()) {
116                stringStatusValues.put(status.status, status);
117            }
118        }
119
120        /**
121         * Look up the {@link Status} based on the string value.
122         *
123         * @param status the status value to lookup.
124         * @return VerifyStatus based on the int value given.
125         */
126        public static Status fromString(String status) {
127            return stringStatusValues.get(status);
128        }
129
130        Status(String status) {
131            this.status = status;
132        }
133
134        @JsonValue
135        public String getStatus() {
136            return this.status;
137        }
138    }
139}