//-----------------------------------------------------------------------
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//-----------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
    using System;
    using System.Collections.ObjectModel;
    /// 
    /// Represents the Subject element specified in [Saml2Core, 2.4.1].
    /// 
    /// 
    /// If the NameId is null and the SubjectConfirmations collection is empty,
    /// an InvalidOperationException will be thrown during serialization.
    /// 
    public class Saml2Subject
    {
        private Saml2NameIdentifier nameId;
        private Collection subjectConfirmations = new Collection();
        /// 
        /// Initialize an instance of .
        /// 
        public Saml2Subject()
        {
        }
        /// 
        /// Initializes an instance of  from a .
        /// 
        /// The  to use for initialization.
        public Saml2Subject(Saml2NameIdentifier nameId)
        {
            this.nameId = nameId;
        }
        /// 
        /// Initializes an instance of  from a .
        /// 
        /// The  to use for initialization.
        public Saml2Subject(Saml2SubjectConfirmation subjectConfirmation)
        {
            if (null == subjectConfirmation)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("subjectConfirmation");
            }
            this.subjectConfirmations.Add(subjectConfirmation);
        }
        /// 
        /// Gets or sets the . [Saml2Core, 2.4.1]
        /// 
        public Saml2NameIdentifier NameId
        {
            get { return this.nameId; }
            set { this.nameId = value; }
        }
        /// 
        /// Gets a collection of  which can be used to validate and confirm the . [Saml2Core, 2.4.1]
        /// 
        /// 
        /// If more than one subject confirmation is provied, then satisfying any one of 
        /// them is sufficient to confirm the subject for the purpose of applying the 
        /// assertion.
        /// 
        public Collection SubjectConfirmations
        {
            get { return this.subjectConfirmations; }
        }
    }
}