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: phase.go
    path of file: ./repos/coraza/types
    
    the code of the file until where you have to start completion: // Copyright 2022 Juan Pablo Tosso and the OWASP Coraza contributors
// SPDX-License-Identifier: Apache-2.0

package types

import (
	"fmt"
	"strconv"
)

// RulePhase is the phase of the rule
type RulePhase int

const (
	// PhaseUnknown represents a phase unrecognized by Coraza
	Pha
    
func ParseRulePhase(phase string) (RulePhase, error) {
	var i int
	switch phase {
	case "request":
		i = 2
	case "response":
		i = 4
	case "logging":
		i = 5
	default:
		// When phase parsing fails, will be 0,
		// so there is no need to judge error.
		i, _ = strconv.Atoi(phase)
	}
	if i > 5 || i < 1 {
		return PhaseUnknown, fmt.Errorf("invalid phase %s", phase)
	}
	return RulePhase(i), nil
}