/*===============================================================================================================================================================================*
 *     PROJECT: Pullman
 *    FILENAME: EntityRef.swift
 *         IDE: AppCode
 *      AUTHOR: Galen Rhodes
 *        DATE: 11/28/21
 *
 * Copyright © 2021. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this
 * permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *===============================================================================================================================================================================*/

import Foundation
import CoreFoundation
import Rubicon

public class EntityRef: Node {
    //@f:0
    public override var nodeType:     NodeType { .EntityRef }
    public override var nodeName:     String   { nsName.qualifiedName }
    public override var localName:    String   { nsName.localName }
    public override var prefix:       String?  { nsName.prefix }
    public override var namespaceURI: String?  { nsName.namespaceURI }

    public          var name:         String   { nsName.qualifiedName }

    private         let nsName:       NSName
    internal        var entity:       EntityDecl
    //@f:1

    public init(ownerDocument: Document, qualifiedName: String, namespaceURI: String?, entity: EntityDecl) throws {
        nsName = try NSName(qualifiedName: qualifiedName, namespaceURI: namespaceURI)
        self.entity = entity
        super.init(ownerDocument: ownerDocument)
    }
}
