// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.oer.its.etsi102941;

import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.oer.its.ieee1609dot2.basetypes.HashedId8;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Object;

public class CtlDelete extends ASN1Object implements ASN1Choice
{
    public static final int cert = 0;
    public static final int dc = 1;
    private final int choice;
    private final ASN1Encodable ctlDelete;
    
    public static CtlDelete cert(final HashedId8 hashedId8) {
        return new CtlDelete(0, hashedId8);
    }
    
    public static CtlDelete dc(final DcDelete dcDelete) {
        return new CtlDelete(1, dcDelete);
    }
    
    public CtlDelete(final int n, final ASN1Encodable asn1Encodable) {
        switch (this.choice = n) {
            case 0: {
                this.ctlDelete = HashedId8.getInstance(asn1Encodable);
                return;
            }
            case 1: {
                this.ctlDelete = DcDelete.getInstance(asn1Encodable);
                return;
            }
            default: {
                throw new IllegalArgumentException("invalid choice value " + n);
            }
        }
    }
    
    private CtlDelete(final ASN1TaggedObject asn1TaggedObject) {
        this(asn1TaggedObject.getTagNo(), asn1TaggedObject.getExplicitBaseObject());
    }
    
    public static CtlDelete getInstance(final Object o) {
        if (o instanceof CtlDelete) {
            return (CtlDelete)o;
        }
        if (o != null) {
            return new CtlDelete(ASN1TaggedObject.getInstance(o, 128));
        }
        return null;
    }
    
    public int getChoice() {
        return this.choice;
    }
    
    public ASN1Encodable getCtlDelete() {
        return this.ctlDelete;
    }
    
    @Override
    public ASN1Primitive toASN1Primitive() {
        return new DERTaggedObject(this.choice, this.ctlDelete);
    }
}
