You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: certificate_type.go
    path of file: ./repos/moby/vendor/github.com/zmap/zcrypto/x509
    
    the code of the file until where you have to start completion: // Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package x509

import "encoding/json"

// TODO: Automatically generate this file from a CSV

// CertificateT
    
func (t *CertificateType) UnmarshalJSON(b []byte) error {
	var certificateTypeString string
	if err := json.Unmarshal(b, &certificateTypeString); err != nil {
		return err
	}
	switch certificateTypeString {
	case certificateTypeStringLeaf:
		*t = CertificateTypeLeaf
	case certificateTypeStringIntermediate:
		*t = CertificateTypeIntermediate
	case certificateTypeStringRoot:
		*t = CertificateTypeRoot
	default:
		*t = CertificateTypeUnknown
	}
	return nil
}