// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

package ice

import (
	
)

// Role represents ICE agent role, which can be controlling or controlled.
type Role byte

// Possible ICE agent roles.
const (
	Controlling Role = iota
	Controlled
)

// UnmarshalText implements TextUnmarshaler.
func ( *Role) ( []byte) error {
	switch string() {
	case "controlling":
		* = Controlling
	case "controlled":
		* = Controlled
	default:
		return fmt.Errorf("%w %q", errUnknownRole, )
	}

	return nil
}

// MarshalText implements TextMarshaler.
func ( Role) () ( []byte,  error) {
	return []byte(.String()), nil
}

func ( Role) () string {
	switch  {
	case Controlling:
		return "controlling"
	case Controlled:
		return "controlled"
	default:
		return "unknown"
	}
}