/*_############################################################################
  _## 
  _##  SNMP4J-AgentX - MasterContextInfo.java  
  _## 
  _##  Copyright (C) 2005-2026  Frank Fock (SNMP4J.org)
  _##  
  _##  This program is free software; you can redistribute it and/or modify
  _##  it under the terms of the GNU General Public License version 2 as 
  _##  published by the Free Software Foundation.
  _##
  _##  This program 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 this program; if not, write to the Free Software
  _##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
  _##  MA  02110-1301  USA
  _##  
  _##########################################################################*/

package org.snmp4j.agent.agentx.master;

import java.io.Serializable;

import org.snmp4j.agent.mo.snmp.SysUpTime;
import org.snmp4j.smi.OctetString;

/**
 * An AgentX master agent needs to manage certain context related information
 * which this class holds. The most important of this information is the
 * context's uptime (derived from the sysUpTime object of the context - if
 * present).
 *
 * @author Frank Fock
 * @version 3.0
 */
public class MasterContextInfo implements Serializable, Comparable<MasterContextInfo> {

    private static final long serialVersionUID = 1940496150873271394L;

    /**
     * The context this information is associated with.
     */
    private final OctetString context;

    /**
     * The uptime of the context, derived from its sysUpTime object.
     */
    private final SysUpTime upTime;

    /**
     * Creates a new {@link MasterContextInfo} for a context and its uptime.
     * @param context
     *    the context this information is associated with.
     * @param contextUpTime
     *    the uptime of the context (derived from its sysUpTime object).
     */
    public MasterContextInfo(OctetString context, SysUpTime contextUpTime) {
        this.context = context;
        this.upTime = contextUpTime;
    }

    @Override
    public int compareTo(MasterContextInfo o) {
        return context.compareTo(o.context);
    }

    /**
     * Gets the context this information is associated with.
     * @return
     *    the context {@link OctetString}.
     */
    public OctetString getContext() {
        return context;
    }

    /**
     * Gets the uptime of the context.
     * @return
     *    the context's {@link SysUpTime}.
     */
    public SysUpTime getUpTime() {
        return upTime;
    }

}
