001/*
002 *   Copyright 2024 Vonage
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 */
016package com.vonage.client.proactiveconnect;
017
018import com.fasterxml.jackson.annotation.JsonProperty;
019import com.vonage.client.Jsonable;
020import com.vonage.client.JsonableBaseObject;
021import java.time.Instant;
022import java.util.Map;
023import java.util.UUID;
024
025/**
026 * Represents a list item in the Proactive Connect API.
027 */
028public class ListItem extends JsonableBaseObject {
029        private Map<String, ?> data;
030        private Instant createdAt, updatedAt;
031        private UUID id, listId;
032
033        protected ListItem() {
034        }
035
036        /**
037         * Custom data as key-value pairs for this list.
038         *
039         * @return The list data as a Map, or {@code null} if unset.
040         */
041        @JsonProperty("data")
042        public Map<String, ?> getData() {
043                return data;
044        }
045
046        /**
047         * Time this item was created, in ISO 8601 format.
048         *
049         * @return The creation timestamp, or {@code null} if unknown.
050         */
051        @JsonProperty("created_at")
052        public Instant getCreatedAt() {
053                return createdAt;
054        }
055
056        /**
057         * Time this item was last updated, in ISO 8601 format.
058         *
059         * @return The last update timestamp, or {@code null} if unknown.
060         */
061        @JsonProperty("updated_at")
062        public Instant getUpdatedAt() {
063                return updatedAt;
064        }
065
066        /**
067         * Unique identifier for this item.
068         *
069         * @return The item ID or {@code null} if unknown.
070         */
071        @JsonProperty("id")
072        public UUID getId() {
073                return id;
074        }
075
076        /**
077         * Unique identifier for this list.
078         *
079         * @return The list ID or {@code null} if unknown.
080         */
081        @JsonProperty("list_id")
082        public UUID getListId() {
083                return listId;
084        }
085        
086        /**
087         * Creates an instance of this class from a JSON payload.
088         *
089         * @param json The JSON string to parse.
090         * @return An instance of this class with the fields populated, if present.
091         */
092        public static ListItem fromJson(String json) {
093                return Jsonable.fromJson(json);
094        }
095}