2019-06-18 14:54:32 +02:00
|
|
|
package app.fedilab.android.client.Entities;
|
|
|
|
/* Copyright 2019 Thomas Schneider
|
|
|
|
*
|
|
|
|
* This file is a part of Fedilab
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Fedilab 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 Fedilab; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
2019-09-06 17:55:14 +02:00
|
|
|
|
2019-06-18 14:54:32 +02:00
|
|
|
import android.os.Parcel;
|
|
|
|
import android.os.Parcelable;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
2019-06-22 11:01:01 +02:00
|
|
|
import app.fedilab.android.client.API;
|
|
|
|
|
2019-06-18 14:54:32 +02:00
|
|
|
public class AccountAdmin implements Parcelable {
|
|
|
|
|
2019-11-15 16:32:25 +01:00
|
|
|
public static final Creator<AccountAdmin> CREATOR = new Creator<AccountAdmin>() {
|
|
|
|
@Override
|
|
|
|
public AccountAdmin createFromParcel(Parcel source) {
|
|
|
|
return new AccountAdmin(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public AccountAdmin[] newArray(int size) {
|
|
|
|
return new AccountAdmin[size];
|
|
|
|
}
|
|
|
|
};
|
2019-06-18 14:54:32 +02:00
|
|
|
private String id;
|
|
|
|
private String username;
|
|
|
|
private Date created_at;
|
|
|
|
private String email;
|
|
|
|
private String role;
|
|
|
|
private String ip;
|
2019-06-22 09:38:19 +02:00
|
|
|
private String domain;
|
2019-06-18 14:54:32 +02:00
|
|
|
private boolean confirmed;
|
|
|
|
private boolean suspended;
|
|
|
|
private boolean silenced;
|
|
|
|
private boolean disabled;
|
2019-06-18 16:22:53 +02:00
|
|
|
private Account account;
|
2019-06-22 11:01:01 +02:00
|
|
|
private API.adminAction action;
|
2019-06-22 15:15:47 +02:00
|
|
|
private boolean approved;
|
2019-06-18 14:54:32 +02:00
|
|
|
|
2019-11-15 16:32:25 +01:00
|
|
|
public AccountAdmin() {
|
|
|
|
}
|
|
|
|
|
2020-05-07 16:16:54 +02:00
|
|
|
private AccountAdmin(Parcel in) {
|
2019-11-15 16:32:25 +01:00
|
|
|
this.id = in.readString();
|
|
|
|
this.username = in.readString();
|
|
|
|
long tmpCreated_at = in.readLong();
|
|
|
|
this.created_at = tmpCreated_at == -1 ? null : new Date(tmpCreated_at);
|
|
|
|
this.email = in.readString();
|
|
|
|
this.role = in.readString();
|
|
|
|
this.ip = in.readString();
|
|
|
|
this.domain = in.readString();
|
|
|
|
this.confirmed = in.readByte() != 0;
|
|
|
|
this.suspended = in.readByte() != 0;
|
|
|
|
this.silenced = in.readByte() != 0;
|
|
|
|
this.disabled = in.readByte() != 0;
|
|
|
|
this.account = in.readParcelable(Account.class.getClassLoader());
|
|
|
|
int tmpAction = in.readInt();
|
|
|
|
this.action = tmpAction == -1 ? null : API.adminAction.values()[tmpAction];
|
|
|
|
this.approved = in.readByte() != 0;
|
|
|
|
}
|
|
|
|
|
2019-06-18 14:54:32 +02:00
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getUsername() {
|
|
|
|
return username;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsername(String username) {
|
|
|
|
this.username = username;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getCreated_at() {
|
|
|
|
return created_at;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCreated_at(Date created_at) {
|
|
|
|
this.created_at = created_at;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getEmail() {
|
|
|
|
return email;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEmail(String email) {
|
|
|
|
this.email = email;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getRole() {
|
|
|
|
return role;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRole(String role) {
|
|
|
|
this.role = role;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getIp() {
|
|
|
|
return ip;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIp(String ip) {
|
|
|
|
this.ip = ip;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isConfirmed() {
|
|
|
|
return confirmed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setConfirmed(boolean confirmed) {
|
|
|
|
this.confirmed = confirmed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isSuspended() {
|
|
|
|
return suspended;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSuspended(boolean suspended) {
|
|
|
|
this.suspended = suspended;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isSilenced() {
|
|
|
|
return silenced;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSilenced(boolean silenced) {
|
|
|
|
this.silenced = silenced;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isDisabled() {
|
|
|
|
return disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDisabled(boolean disabled) {
|
|
|
|
this.disabled = disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Account getAccount() {
|
|
|
|
return account;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAccount(Account account) {
|
|
|
|
this.account = account;
|
|
|
|
}
|
|
|
|
|
2019-06-22 09:38:19 +02:00
|
|
|
public String getDomain() {
|
|
|
|
return domain;
|
|
|
|
}
|
2019-06-18 14:54:32 +02:00
|
|
|
|
2019-06-22 09:38:19 +02:00
|
|
|
public void setDomain(String domain) {
|
|
|
|
this.domain = domain;
|
|
|
|
}
|
2019-06-18 14:54:32 +02:00
|
|
|
|
2019-06-22 15:15:47 +02:00
|
|
|
public API.adminAction getAction() {
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAction(API.adminAction action) {
|
|
|
|
this.action = action;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isApproved() {
|
|
|
|
return approved;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setApproved(boolean approved) {
|
|
|
|
this.approved = approved;
|
|
|
|
}
|
|
|
|
|
2019-06-18 14:54:32 +02:00
|
|
|
@Override
|
|
|
|
public int describeContents() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void writeToParcel(Parcel dest, int flags) {
|
|
|
|
dest.writeString(this.id);
|
|
|
|
dest.writeString(this.username);
|
|
|
|
dest.writeLong(this.created_at != null ? this.created_at.getTime() : -1);
|
|
|
|
dest.writeString(this.email);
|
|
|
|
dest.writeString(this.role);
|
|
|
|
dest.writeString(this.ip);
|
2019-06-22 09:38:19 +02:00
|
|
|
dest.writeString(this.domain);
|
2019-06-18 14:54:32 +02:00
|
|
|
dest.writeByte(this.confirmed ? (byte) 1 : (byte) 0);
|
|
|
|
dest.writeByte(this.suspended ? (byte) 1 : (byte) 0);
|
|
|
|
dest.writeByte(this.silenced ? (byte) 1 : (byte) 0);
|
|
|
|
dest.writeByte(this.disabled ? (byte) 1 : (byte) 0);
|
|
|
|
dest.writeParcelable(this.account, flags);
|
2019-06-22 15:15:47 +02:00
|
|
|
dest.writeInt(this.action == null ? -1 : this.action.ordinal());
|
|
|
|
dest.writeByte(this.approved ? (byte) 1 : (byte) 0);
|
2019-06-18 14:54:32 +02:00
|
|
|
}
|
|
|
|
}
|