package com.linx.lio;

import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;

class NSU {
    private final String value;

    NSU(@NotNull final String value) {
        this.value = value;
    }

    final String getValue() {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        return this == obj || obj instanceof NSU && value.equals(((NSU) obj).value);
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    static NSU fromJSONObject(@NotNull final JSONObject jsonObject) throws JSONException {
        return new NSU(jsonObject.getString("nsu"));
    }
}
