package com.amazon.ads.ema.api.model;

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

/**
 * WiFi configuration parameters
 */
public class WifiConfig implements Parcelable {
    public static final Creator<WifiConfig> CREATOR = new Creator<>() {
        @Override
        public WifiConfig createFromParcel(Parcel in) {
            return new WifiConfig(in);
        }

        @Override
        public WifiConfig[] newArray(int size) {
            return new WifiConfig[size];
        }
    };
    public String ssid;
    public String password;
    public String securityType;     // "OPEN", "WEP", "WPA", "WPA2_PSK", "WPA3"
    public boolean hidden;
    public int priority;
    public StaticIpConfig staticIp; // null for DHCP

    public WifiConfig() {
    }

    protected WifiConfig(Parcel in) {
        ssid = in.readString();
        password = in.readString();
        securityType = in.readString();
        hidden = in.readByte() != 0;
        priority = in.readInt();
        staticIp = in.readParcelable(StaticIpConfig.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(ssid);
        dest.writeString(password);
        dest.writeString(securityType);
        dest.writeByte((byte) (hidden ? 1 : 0));
        dest.writeInt(priority);
        dest.writeParcelable(staticIp, flags);
    }

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