/*
 * Auto-CreamAPI
 * Copyright (C) 2020 Jeddunk
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
 */

package xyz.jeddunk.autocreamapi.pojo;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@SuppressWarnings("unused")
public class App {

    @SerializedName("appid")
    @Expose
    private Integer appId;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("last_modified")
    @Expose
    private Integer lastModified;
    @SerializedName("price_change_number")
    @Expose
    private Integer priceChangeNumber;

    public Integer getAppId() {
        return appId;
    }

    public void setAppId(Integer appId) {
        this.appId = appId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLastModified() {
        return lastModified;
    }

    public void setLastModified(Integer lastModified) {
        this.lastModified = lastModified;
    }

    public Integer getPriceChangeNumber() {
        return priceChangeNumber;
    }

    public void setPriceChangeNumber(Integer priceChangeNumber) {
        this.priceChangeNumber = priceChangeNumber;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(App.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
        sb.append("appid");
        sb.append('=');
        sb.append(((this.appId == null)?"<null>":this.appId));
        sb.append(',');
        sb.append("name");
        sb.append('=');
        sb.append(((this.name == null)?"<null>":this.name));
        sb.append(',');
        sb.append("lastModified");
        sb.append('=');
        sb.append(((this.lastModified == null)?"<null>":this.lastModified));
        sb.append(',');
        sb.append("priceChangeNumber");
        sb.append('=');
        sb.append(((this.priceChangeNumber == null)?"<null>":this.priceChangeNumber));
        sb.append(',');
        if (sb.charAt((sb.length()- 1)) == ',') {
            sb.setCharAt((sb.length()- 1), ']');
        } else {
            sb.append(']');
        }
        return sb.toString();
    }

    @Override
    public int hashCode() {
        int result = 1;
        result = ((result* 31)+((this.name == null)? 0 :this.name.hashCode()));
        result = ((result* 31)+((this.lastModified == null)? 0 :this.lastModified.hashCode()));
        result = ((result* 31)+((this.priceChangeNumber == null)? 0 :this.priceChangeNumber.hashCode()));
        result = ((result* 31)+((this.appId == null)? 0 :this.appId.hashCode()));
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if (!(other instanceof App)) {
            return false;
        }
        App rhs = ((App) other);
        boolean b1 = Objects.equals(this.name, rhs.name);
        boolean b2 = Objects.equals(this.lastModified, rhs.lastModified);
        boolean b3 = Objects.equals(this.priceChangeNumber, rhs.priceChangeNumber);
        boolean b4 = Objects.equals(this.appId, rhs.appId);
        return b1 && b2 && b3 && b4;
    }

    public static class Rezponze {

        @SerializedName("apps")
        @Expose
        private List<App> apps = new ArrayList<>();

        public List<App> getApps() {
            return apps;
        }

        public void setApps(List<App> apps) {
            this.apps = apps;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append(Rezponze.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
            sb.append("apps");
            sb.append('=');
            sb.append(((this.apps == null)?"<null>":this.apps));
            sb.append(',');
            if (sb.charAt((sb.length()- 1)) == ',') {
                sb.setCharAt((sb.length()- 1), ']');
            } else {
                sb.append(']');
            }
            return sb.toString();
        }

        @Override
        public int hashCode() {
            int result = 1;
            result = ((result* 31)+((this.apps == null)? 0 :this.apps.hashCode()));
            return result;
        }

        @Override
        public boolean equals(Object other) {
            if (other == this) {
                return true;
            }
            if (!(other instanceof Rezponze)) {
                return false;
            }
            Rezponze rhs = ((Rezponze) other);
            return Objects.equals(this.apps, rhs.apps);
            //return ((this.apps == rhs.apps)||((this.apps!= null)&&this.apps.equals(rhs.apps)));
        }

        public static class Download {

            @SerializedName("response")
            @Expose
            private Rezponze response;

            public Rezponze getResponse() {
                return response;
            }

            public void setResponse(Rezponze response) {
                this.response = response;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                sb.append(Download.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
                sb.append("response");
                sb.append('=');
                sb.append(((this.response == null)?"<null>":this.response));
                sb.append(',');
                if (sb.charAt((sb.length()- 1)) == ',') {
                    sb.setCharAt((sb.length()- 1), ']');
                } else {
                    sb.append(']');
                }
                return sb.toString();
            }

            @Override
            public int hashCode() {
                int result = 1;
                result = ((result* 31)+((this.response == null)? 0 :this.response.hashCode()));
                return result;
            }

            @Override
            public boolean equals(Object other) {
                if (other == this) {
                    return true;
                }
                if (!(other instanceof Download)) {
                    return false;
                }
                Download rhs = ((Download) other);
                return Objects.equals(this.response, rhs.response);
                //return ((this.response == rhs.response)||((this.response!= null)&&this.response.equals(rhs.response)));
            }

        }
    }
}
