classdef Events < types.core.LabMetaData & types.untyped.GroupClass
% EVENTS A group of events


% PROPERTIES
properties
    eventdata; % event data attributes
end

methods
    function obj = Events(varargin)
        % EVENTS Constructor for Events
        %     obj = EVENTS(parentname1,parentvalue1,..,parentvalueN,parentargN,name1,value1,...,nameN,valueN)
        % eventdata = eventdata
        obj = obj@types.core.LabMetaData(varargin{:});
        [obj.eventdata, ivarargin] = types.util.parseConstrained(obj,'eventdata', 'types.ndx_cell_explorer.eventdata', varargin{:});
        varargin(ivarargin) = [];
        
        p = inputParser;
        p.KeepUnmatched = true;
        p.PartialMatching = false;
        p.StructExpand = false;
        misc.parseSkipInvalidName(p, varargin);
        if strcmp(class(obj), 'types.ndx_cell_explorer.Events')
            types.util.checkUnset(obj, unique(varargin(1:2:end)));
        end
    end
    %% SETTERS
    function obj = set.eventdata(obj, val)
        obj.eventdata = obj.validate_eventdata(val);
    end
    %% VALIDATORS
    
    function val = validate_eventdata(obj, val)
        constrained = {'types.ndx_cell_explorer.eventdata'};
        types.util.checkSet('eventdata', struct(), constrained, val);
    end
    %% EXPORT
    function refs = export(obj, fid, fullpath, refs)
        refs = export@types.core.LabMetaData(obj, fid, fullpath, refs);
        if any(strcmp(refs, fullpath))
            return;
        end
        if ~isempty(obj.eventdata)
            refs = obj.eventdata.export(fid, fullpath, refs);
        end
    end
end

end