package com.cloudcc.core;

import java.util.HashMap;

/**
 * CCObject class is the core object class of the system, inherits from HashMap, used to store and manage cloud platform object data
 * This class provides methods to set and get object API names and sharing status
 */
public class CCObject extends HashMap<String, Object> {
    /** Key constant for object API name */
    public static final String OBJECT_API = "CCObjectAPI";
    /** Key constant for object sharing status */
    public static final String IS_SHARED = "isShared";
    /** Key constant for summary field */
    public static final String SUM = "sum";

    /**
     * No-argument constructor, creates an empty CCObject object
     */
    public CCObject() {
    }

    /**
     * Constructor with object API name
     * 
     * @param ccobj object API name
     */
    public CCObject(String ccobj) {
        put(OBJECT_API, ccobj);

    }

    /**
     * Constructor with object API name and sharing status
     * 
     * @param ccobj    object API name
     * @param isShared sharing status flag
     */
    public CCObject(String ccobj, String isShared) {
        put(OBJECT_API, ccobj);
        put(IS_SHARED, "isShared");
    }

    /**
     * Store summary value
     * 
     * @param sumValueKey key name of the summary value
     * @param value       the summary value
     */
    public void putSumValue(String sumValueKey, String value) {
        put(SUM + sumValueKey, value);
    }

    /**
     * Get summary value
     * 
     * @param sumValueKey key name of the summary value
     * @return the summary value for the corresponding key name
     */
    public Object getSumValue(String sumValueKey) {
        return get(SUM + sumValueKey);
    }

    /**
     * Get the API name of the object
     * 
     * @return object API name string
     */
    public String getObjectApiName() {
        return (String) get(OBJECT_API);
    }

}
