// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package components

import (
	"encoding/json"
	"fmt"
)

type BoolInt int

const (
	BoolIntFalse BoolInt = 0
	BoolIntTrue  BoolInt = 1
)

func (e BoolInt) ToPointer() *BoolInt {
	return &e
}
func (e *BoolInt) UnmarshalJSON(data []byte) error {
	var v int
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case 0:
		fallthrough
	case 1:
		*e = BoolInt(v)
		return nil
	default:
		return fmt.Errorf("invalid value for BoolInt: %v", v)
	}
}
