@Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Account extends PushbulletObject implements Deletable {

    /**
     * The type of this account
     */
    private String type;

    /**
     * The id of this account
     */
    private String id;

    /**
     * The email of this account
     */
    private String email;

    /**
     * The normalized email of this account
     */
    @SerializedName("email_normalized")
    private String normalizedEmail;

    /**
     * The name of this account
     */
    private String name;

    /**
     * The url to the image of this account
     */
    @SerializedName("image_url")
    private String imageUrl;

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificAccountRequest(getIdentity()));
        setActive(false);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Block extends PushbulletObject implements Deletable {

    private BlockedUser user;

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificBlockRequest(getIdentity()));
        setActive(false);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class OwnChannel extends PushbulletObject implements Deletable {

    /**
     * The tag of this channel
     */
    private String tag;

    /**
     * The name of this channel
     */
    private String name;

    /**
     * The description of this channel
     */
    private String description;

    /**
     * The url to the image of this channel
     */
    @SerializedName("image_url")
    private String imageUrl;

    public void push(SendablePush push) {
        if(!isActive()) return;
        push = push.clone().setReceiver(ReceiverType.CHANNEL, tag);
        getPushbullet().executeRequest(new SendPushToChannelRequest(push));
    }

    public void sendPush(Pushbullet pushbullet, SendablePush push) {
        pushbullet.executeRequest(new SendPushRequest(push));
    }

    /**
     * Used to push a link to this channel
     * @param title The title of the push
     * @param body  The body of the push
     * @param url   The link of the push
     */
    public void pushLink(String title, String body, String url) {
        push(new SendableLinkPush(title, body, url));
    }

    /**
     * Used to push an address to this channel
     * @param name    The name of the address
     * @param address The address
     */
    @Deprecated
    public void pushAddress(String name, String address) {
        push(new SendableAddressPush(name, address));
    }

    /**
     * Used to push a note to this channel
     * @param title The title of the note
     * @param body  The body of the note
     */
    public void pushNote(String title, String body) {
        push(new SendableNotePush(title, body));
    }

    /**
     * Used to push a list to this channel
     * @param title The title of the list
     * @param items The items of the list
     */
    @Deprecated
    public void pushList(String title, List<String> items) {
        push(new SendableListPush(title, items));
    }

    /**
     * Used to push a file to this
     * @param body The body of this push
     * @param file The file of this push
     */
    public void pushFile(String body, UploadFile file) {
        push(new SendableFilePush(body, file));
    }

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificChannelRequest(getIdentity()));
        setActive(false);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Subscription extends PushbulletObject implements Deletable, Mutable, Unsubscribable {

    /**
     * The channel info of this subscription
     */
    private ChannelInfo channel;

    /**
     * Whether this subscription is muted
     */
    private boolean muted;

    @Override
    public void unsubscribe() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificSubscriptionRequest(getIdentity()));
        setActive(false);
    }

    @Override
    public void delete() {
        unsubscribe();
    }

    public void mute() {
        updateMute(true);
    }

    public void unmute() {
        updateMute(false);
    }

    private void updateMute(boolean muteStatus) {
        getPushbullet().executeRequest(new UpdateSubscriptionMuteStatusRequest(getIdentity(), muteStatus));
        muted = muteStatus;
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Chat extends PushbulletObject implements Deletable, Mutable, Pushable, Blockable {

    /**
     * The user this chat is held with
     */
    private ChatUser with;

    /**
     * Whether this chat is muted
     */
    private boolean muted;

    @Override
    public void delete() {
        if(!isActive()) return;
        DeleteSpecificChatRequest chatRequest = new DeleteSpecificChatRequest(getIdentity());
        getPushbullet().executeRequest(chatRequest);
        setActive(false);
    }

    public void mute() {
        updateMute(true);
    }

    public void unmute() {
        updateMute(false);
    }

    /**
     * Used to block the user this chat is held with
     */
    @Override
    public void block() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new BlockUserRequest(getWith().getEmail()));
        setActive(false);
    }

    private void updateMute(boolean muteStatus) {
        getPushbullet().executeRequest(new UpdateChatMuteStatusRequest(getIdentity(), muteStatus));
        muted = muteStatus;
    }

    @Override
    public Push push(SendablePush push) {
        return with.push(push);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Device extends PushbulletObject implements Deletable, Pushable, SmsSendable {

    /**
     * The nickname of this device
     */
    private String nickname;

    /**
     * Whether the nickname of this device has been generated
     */
    @SerializedName("generated_nickname")
    private boolean nicknameGenerated;

    /**
     * The type of this device
     */
    private String type;

    /**
     * The kind of this device
     */
    private String kind;

    /**
     * The icon of this device
     */
    private String icon;

    /**
     * Whether it is possible to push to this device
     */
    private boolean pushable;

    /**
     * The push token for this device
     */
    @SerializedName("push_token")
    private String pushToken;

    /**
     * The app version of the pushbullet app on this device
     */
    @SerializedName("app_version")
    private int appVersion;

    /**
     * The fingerprint of this device
     */
    @SerializedName("fingerprint")
    private String fingerPrint;

    /**
     * The manufacturer of this device
     */
    private String manufacturer;

    /**
     * The model of this device
     */
    private String model;

    @SerializedName("has_sms")
    @Accessors(fluent = true)
    private boolean hasSms;

    public Push push(SendablePush push) {
        if(!isPushable()) return null;
        push = push.clone();
        push.setReceiver(ReceiverType.DEVICE, getIdentity());
        return sendPush(getPushbullet(), push);
    }

    /**
     * Sent a text to the clipboard of the other registered devices that have universal copy paste enabled
     * @param content The text to
     * @param toTypes The types of the devices that should receive the text, leave empty for all
     */
    public void sendToOtherClipboards(String content, String... toTypes) {
        ClipEphemeral push = new ClipEphemeral();
        push.setBody(content)
                .setSourceDeviceIdentity(getIdentity());
        getPushbullet().pushEphemeral(push, toTypes);
    }

    /**
     * Returns all pushes that this device has received
     * @return A list of pushes that this device has received
     */
    public List<Push> getReceivedPushes() {
        return getPushbullet().getAllPushes().stream().filter(push -> getIdentity().equals(push.getTargetDeviceIdentity())).collect(Collectors.toList());
    }

    /**
     * Returns the phonebook of this device
     * @return The phonebook of this device
     */
    public Phonebook getPhonebook() {
        Phonebook phonebook = getPushbullet().executeRequest(new ListPhonebookRequest(getIdentity()));
        phonebook.setDevice(this);
        return phonebook;
    }

    @Override
    public void delete() {
        if(!isActive()) return;
        DeleteSpecificDeviceRequest deleteSpecificDeviceRequest = new DeleteSpecificDeviceRequest(getIdentity());
        getPushbullet().executeRequest(deleteSpecificDeviceRequest);
        setActive(false);
    }

    @Override
    public void sendSMS(String number, String body) {
        if(!isActive()) return;
        if(!hasSms()) return;
        SmsReplyEphemeral smsReplyEphemeralPush = new SmsReplyEphemeral();
        smsReplyEphemeralPush
                .setMessage(body)
                .setPackageName("com.pushbullet.android")
                .setPhoneNumber(number)
                .setTargetDeviceIdentity(getIdentity())
                .setSourceUserIdentity(getPushbullet().getCurrentUser().getIdentity());
        getPushbullet().pushEphemeral(smsReplyEphemeralPush);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Grant extends PushbulletObject implements Deletable {

    /**
     * The "granted client" of this grant
     */
    private GrantClient client;

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificGrantRequest(getIdentity()));
        setActive(false);
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class OAuthClient extends PushbulletObject implements Deletable {

    /**
     * The name of this client
     */
    private String name;

    /**
     * The url to the image of this client
     */
    @SerializedName("image_url")
    private String imageUrl;

    /**
     * The url to the website of this client
     */
    @SerializedName("website_url")
    private String websiteUrl;

    /**
     * The uri users should be redirected to
     */
    @SerializedName("redirect_uri")
    private String redirectUri;

    /**
     * The id of this client
     */
    @SerializedName("client_id")
    private String clientId;

    /**
     * The secret of this client
     */
    @SerializedName("client_secret")
    private String clientSecret;

    /**
     * The allowed origin of this client
     */
    @SerializedName("allowed_origin")
    private String allowedOrigin;

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificClientRequest(getIdentity()));
        setActive(false);
    }
} @Getter
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Push extends PushbulletObject implements Deletable, Dismissable {

    /**
     * The type of the push
     */
    private PushType type;

    /**
     * Whether the push has already been dimissed
     */
    private boolean dismissed;

    /**
     * The direction the push was sent to
     */
    private Direction direction;

    /**
     * The name of the sender
     */
    @SerializedName("sender_name")
    private String senderName;

    /**
     * The identity of the channel the push was sent to
     */
    @SerializedName("channel_iden")
    private String channelIdentity;

    /**
     * The client's identity
     */
    @SerializedName("client_iden")
    private String clientIdentity;

    /**
     * The identity of the device the push was sent to
     */
    @SerializedName("target_device_iden")
    private String targetDeviceIdentity;

    /**
     * The sender's identity
     */
    @SerializedName("sender_iden")
    private String senderIdentity;

    /**
     * The sender's email
     */
    @SerializedName("sender_email")
    private String senderEmail;

    /**
     * The sender's normalized email
     */
    @SerializedName("sender_email_normalized")
    private String normalizedSenderEmail;

    /**
     * The receiver's identity
     */
    @SerializedName("receiver_iden")
    private String receiverIdentity;

    /**
     * The receiver's email
     */
    @SerializedName("receiver_email")
    private String receiverEmail;

    /**
     * The receiver's normalized email
     */
    @SerializedName("receiver_email_normalized")
    private String normalizedReceiverEmail;

    /**
     * The list of awake apps the push was sent to when it was created
     */
    @SerializedName("awake_app_guids")
    private List<String> awakeAppGuids;

    /**
     * A unique identifier for the push, set by the client
     */
    private String guid;

    @Override
    public void delete() {
        if(!isActive()) return;
        DeleteSpecificPushRequest deleteSpecificPushRequest = new DeleteSpecificPushRequest(getIdentity());
        getPushbullet().executeRequest(deleteSpecificPushRequest);
        setActive(false);
    }

    /**
     * Show the push again if it was already dismissed
     */
    public void show() {
        if(!isDismissed()) return;
        getPushbullet().executeRequest(new ChangePushDismissStatusRequest(getIdentity(), false));
        setDismissed(false);
    }

    @Override
    public void dismiss() {
        if(isDismissed()) return;
        getPushbullet().executeRequest(new ChangePushDismissStatusRequest(getIdentity(), true));
        setDismissed(true);
    }

    /**
     * Get the title of this push
     * @return The title of this push
     */
    public String getTitle() {
        return null;
    }

    /**
     * Get the body of this push
     * @return The body of this push
     */
    public String getBody() {
        return null;
    }
} @Getter
@ToString(callSuper = true)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Deprecated
public class Contact extends User implements Deletable {

    /**
     * The status of this contact
     */
    private String status;

    @Override
    public void delete() {
        if(!isActive()) return;
        getPushbullet().executeRequest(new DeleteSpecificContactRequest(getIdentity()));
        setActive(false);
    }
}
import com.github.sheigutn.pushbullet.items.account.Account;
import com.github.sheigutn.pushbullet.items.block.Block;
import com.github.sheigutn.pushbullet.items.channel.OwnChannel;
import com.github.sheigutn.pushbullet.items.channel.Subscription;
import com.github.sheigutn.pushbullet.items.chat.Chat;
import com.github.sheigutn.pushbullet.items.device.Device;
import com.github.sheigutn.pushbullet.items.grant.Grant;
import com.github.sheigutn.pushbullet.items.oauth.OAuthClient;
import com.github.sheigutn.pushbullet.items.push.sent.Push;
import com.github.sheigutn.pushbullet.items.user.Contact;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.List;
package com.github.sheigutn.pushbullet.items;



@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ListResponse {

    /**
     * The list of accounts
     */
    private List<Account> accounts;

    /**
     * The list of blocked users
     */
    private List<Block> blocks;

    /**
     * The list of own channels
     */
    private List<OwnChannel> channels;

    /**
     * The list of own chats
     */
    private List<Chat> chats;

    /**
     * The list of created oauth clients
     */
    private List<OAuthClient> clients;

    /**
     * The list of contacts
     */
    private List<Contact> contacts;

    /**
     * The list of devices
     */
    private List<Device> devices;