/*
 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
 * From ASN.1 module "E2SM-RC-IEs"
 * 	found in "e2sm-rc-nov2021.asn"
 * 	`asn1c -fcompound-names -fno-include-deps -findirect-choice -pdu=auto -gen-PER -gen-OER -no-gen-example -D .`
 */

#include "EventTrigger-UEevent-Info-Item.h"

asn_TYPE_member_t asn_MBR_EventTrigger_UEevent_Info_Item_1[] = {
	{ ATF_NOFLAGS, 0, offsetof(struct EventTrigger_UEevent_Info_Item, ueEventID),
		(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_RIC_EventTrigger_UEevent_ID,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"ueEventID"
		},
	{ ATF_POINTER, 1, offsetof(struct EventTrigger_UEevent_Info_Item, logicalOR),
		(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
		-1,	/* IMPLICIT tag at current level */
		&asn_DEF_LogicalOR,
		0,
		{ 0, 0, 0 },
		0, 0, /* No default value */
		"logicalOR"
		},
};
static const int asn_MAP_EventTrigger_UEevent_Info_Item_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_EventTrigger_UEevent_Info_Item_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_EventTrigger_UEevent_Info_Item_tag2el_1[] = {
    { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ueEventID */
    { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* logicalOR */
};
asn_SEQUENCE_specifics_t asn_SPC_EventTrigger_UEevent_Info_Item_specs_1 = {
	sizeof(struct EventTrigger_UEevent_Info_Item),
	offsetof(struct EventTrigger_UEevent_Info_Item, _asn_ctx),
	asn_MAP_EventTrigger_UEevent_Info_Item_tag2el_1,
	2,	/* Count of tags in the map */
	asn_MAP_EventTrigger_UEevent_Info_Item_oms_1,	/* Optional members */
	1, 0,	/* Root/Additions */
	2,	/* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_EventTrigger_UEevent_Info_Item = {
	"EventTrigger-UEevent-Info-Item",
	"EventTrigger-UEevent-Info-Item",
	&asn_OP_SEQUENCE,
	asn_DEF_EventTrigger_UEevent_Info_Item_tags_1,
	sizeof(asn_DEF_EventTrigger_UEevent_Info_Item_tags_1)
		/sizeof(asn_DEF_EventTrigger_UEevent_Info_Item_tags_1[0]), /* 1 */
	asn_DEF_EventTrigger_UEevent_Info_Item_tags_1,	/* Same as above */
	sizeof(asn_DEF_EventTrigger_UEevent_Info_Item_tags_1)
		/sizeof(asn_DEF_EventTrigger_UEevent_Info_Item_tags_1[0]), /* 1 */
	{ 0, 0, SEQUENCE_constraint },
	asn_MBR_EventTrigger_UEevent_Info_Item_1,
	2,	/* Elements count */
	&asn_SPC_EventTrigger_UEevent_Info_Item_specs_1	/* Additional specs */
};

