/*
 * Copyright (c) 2015. Ncomz. All Rights Reserved
 */

package com.ntels.kneet.v3.common.gcm.service;

import com.ntels.kneet.v3.common.gcm.support.BaseDefaultSharedPreferences;

import android.content.Context;

/**
 * <pre>
 * 1. ClassName :   GcmSharedPreferences
 * 2. FileName  :   GcmSharedPreferences.java
 * 3. Package   :   com.ntels.kneet.v3.common.gcm.service
 * 4. Date      :   2016-12-05
 * 5. Author    :   aaron
 * 6. Comment   :   Initialize
 * </pre>
 */
public class GcmSharedPreferences extends BaseDefaultSharedPreferences {
    private static final String PROPERTY_REG_ID = "registration_id";
    private static final String PROPERTY_UN_REG_YN = "un_reg_yn";

    public GcmSharedPreferences(Context $context) {
        super($context);
    }

    /**
     * SharedPreferences에 GCM 등록 ID 저장.
     *
     * @param reg_id GCM 등록 ID
     */
    public void setRegistrationID(String reg_id) {

        put(PROPERTY_REG_ID, reg_id);
    }

    /**
     * SharedPreferences에 저장된 GCM 등록 ID 가져오기.
     *
     * @return GCM 등록 ID
     */
    public String getRegistrationID() {

        return get(PROPERTY_REG_ID);
    }

    /**
     * GCM 등록 ID 존재 여부 확인.
     *
     * @return GCM 등록 ID 존재 여부
     */
    public Boolean isRegistrationID() {

        if (getRegistrationID() != null && getRegistrationID().length() > 0) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * GCM 미등록 여부 저장.
     *
     * @param UnRegYN GCM 미등록 여부(Y - 미등록)
     */
    public void setUnRegYN(String UnRegYN) {

        put(PROPERTY_UN_REG_YN, UnRegYN);
    }

    /**
     * GCM 미등록 여부 반환.
     *
     * @return 미등록 여부(Y - 미등록)
     */
    public String getUnRegYN() {

        return get(PROPERTY_UN_REG_YN);
    }

}
