module DIAMETER_ts29_229_Templates {

/* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * Templates for AVPs and messages for TS 29.273
 */

import from General_Types all;
import from DIAMETER_Types all;
import from DIAMETER_Templates all;
import from DIAMETER_rfc5447_Templates all;
import from DIAMETER_ts29_272_Templates all;
import from Osmocom_Types all;
import from Misc_Helpers all;

/* 3GPP TS 29.229 section 6.2. Errors in Result-Code AVP values */
type enumerated DIAMETER_ts29_229_ExperimentalResultcode {
	/* Success */
	DIAMETER_FIRST_REGISTRATION 		(2001),
	DIAMETER_SUBSEQUENT_REGISTRATION 	(2002),
	DIAMETER_UNREGISTERED_SERVICE 	 	(2003),
	DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED (2004),
	/* Permanent Failures */
	DIAMETER_ERROR_USER_UNKNOWN			(5001),
	DIAMETER_ERROR_IDENTITIES_DONT_MATCH		(5002),
	DIAMETER_ERROR_IDENTITY_NOT_REGISTERED		(5003),
	DIAMETER_ERROR_ROAMING_NOT_ALLOWED		(5004),
	DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED	(5005),
	DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED	(5006),
	DIAMETER_ERROR_IN_ASSIGNMENT_TYPE		(5007),
	DIAMETER_ERROR_TOO_MUCH_DATA			(5008),
	DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA		(5009),
	DIAMETER_ERROR_FEATURE_UNSUPPORTED		(5011),
	DIAMETER_ERROR_SERVING_NODE_FEATURE_UNSUPPORTED	(5012)
}

/* TS 29.229 6.3.16 Deregistration-Reason */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Deregistration_Reason(template (value) CxDx_3GPP_Reason_Code reason,
                                                                   template (value) octetstring info) := {
	avp := {
		avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_AAA_3GPP_Non_3GPP_User_Data),
		avp_data := {
			avp_CxDx_3GPP_Deregistration_Reason := {
				ts_AVP_CxDx_3GPP_Reason_Code(reason),
				ts_AVP_CxDx_3GPP_Reason_Info(info)
			}
		}
	}
}

/* TS 29.229 6.3.17 Reason-Code AVP */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Reason_Code(template (value) CxDx_3GPP_Reason_Code reason) := {
	avp := {
		avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Reason_Code),
		avp_data := {
			avp_CxDx_3GPP_Reason_Code := reason
		}
	}
}


/* 6.3.18 Reason-Info AVP */
template (value) GenericAVP ts_AVP_CxDx_3GPP_Reason_Info(template (value) octetstring info) := {
	avp := {
		avp_header := ts_DIA_Hdr_3GPP(c_AVP_Code_CxDx_3GPP_Reason_Info),
		avp_data := {
			avp_CxDx_3GPP_Reason_Info := info
		}
	}
}

}
