package com.example.doctor_app_flutter.Model;

import android.os.Parcel;
import android.os.Parcelable;

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

public class SessionStatusModel implements Parcelable {

    @SerializedName("Result")
    @Expose
    private String result;
    @SerializedName("SessionStatus")
    @Expose
    private Integer sessionStatus;
    @SerializedName("IsAuthenticated")
    @Expose
    private Boolean isAuthenticated;
    @SerializedName("MessageStatus")
    @Expose
    private Integer messageStatus;

    protected SessionStatusModel(Parcel in) {
        result = in.readString();
        if (in.readByte() == 0) {
            sessionStatus = null;
        } else {
            sessionStatus = in.readInt();
        }
        byte tmpIsAuthenticated = in.readByte();
        isAuthenticated = tmpIsAuthenticated == 0 ? null : tmpIsAuthenticated == 1;
        if (in.readByte() == 0) {
            messageStatus = null;
        } else {
            messageStatus = in.readInt();
        }
    }

    public static final Creator<SessionStatusModel> CREATOR = new Creator<SessionStatusModel>() {
        @Override
        public SessionStatusModel createFromParcel(Parcel in) {
            return new SessionStatusModel(in);
        }

        @Override
        public SessionStatusModel[] newArray(int size) {
            return new SessionStatusModel[size];
        }
    };

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public Integer getSessionStatus() {
        return sessionStatus;
    }

    public void setSessionStatus(Integer sessionStatus) {
        this.sessionStatus = sessionStatus;
    }

    public Boolean getIsAuthenticated() {
        return isAuthenticated;
    }

    public void setIsAuthenticated(Boolean isAuthenticated) {
        this.isAuthenticated = isAuthenticated;
    }

    public Integer getMessageStatus() {
        return messageStatus;
    }

    public void setMessageStatus(Integer messageStatus) {
        this.messageStatus = messageStatus;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(result);
        if (sessionStatus == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(sessionStatus);
        }
        dest.writeByte((byte) (isAuthenticated == null ? 0 : isAuthenticated ? 1 : 2));
        if (messageStatus == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(messageStatus);
        }
    }
}