For convenience, you could create the content type as part of one of the migrations in your module. This would only run when enabled. It would look something like this...
//Inside of your migration file...
public int UpdateFrom1(){
ContentDefinitionManager.AlterTypeDefinition("Package", cfg=> cfg
.Creatable()
.WithPart("YourCustomPart")
.WithPart("CommonPart")
.WithPart("Whatever other parts you want..."));
return 2;
}
Removing this content type when you disable your module would be the tricky part because it might be kind of unexpected by the user. Maybe "Package" is a type they still want to use with different parts attached. Also, if they manually delete your module without disabling, you can't really write code to respond to that event. The only reliable thing I know of is the IFeatureEventHandler. This would allow you to remove your content type if they disable the module in the admin...
public PackageRemover : IFeatureEventHandler {
private readonly IContentDefinitionManager _contentDefinitionManager;
public PackageRemover(IContentDefinitionManager contentDefinitionManager){
_contentDefinitionManager = contentDefinitionManager;
}
public void Installed(Feature feature){}
public void Enabling(Feature feature){}
public void Enabled(Feature feature){}
public void Disabling(Feature feature){
_contentDefinitionManager.DeleteTypeDefinition("Package");
}
public void Disabled(Feature feature){}
public void Uninstalling(Feature feature){}
public void Uninstalled(Feature feature){}
}