88 lines
2.4 KiB
Go
88 lines
2.4 KiB
Go
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
package coredata
|
|
|
|
import (
|
|
"encoding"
|
|
"fmt"
|
|
)
|
|
|
|
type (
|
|
ThirdPartyVettingStatus string
|
|
)
|
|
|
|
const (
|
|
ThirdPartyVettingStatusPending ThirdPartyVettingStatus = "PENDING"
|
|
ThirdPartyVettingStatusProcessing ThirdPartyVettingStatus = "PROCESSING"
|
|
ThirdPartyVettingStatusCompleted ThirdPartyVettingStatus = "COMPLETED"
|
|
ThirdPartyVettingStatusFailed ThirdPartyVettingStatus = "FAILED"
|
|
)
|
|
|
|
var (
|
|
_ fmt.Stringer = ThirdPartyVettingStatus("")
|
|
_ encoding.TextMarshaler = ThirdPartyVettingStatus("")
|
|
_ encoding.TextUnmarshaler = (*ThirdPartyVettingStatus)(nil)
|
|
)
|
|
|
|
func ThirdPartyVettingStatuses() []ThirdPartyVettingStatus {
|
|
return []ThirdPartyVettingStatus{
|
|
ThirdPartyVettingStatusPending,
|
|
ThirdPartyVettingStatusProcessing,
|
|
ThirdPartyVettingStatusCompleted,
|
|
ThirdPartyVettingStatusFailed,
|
|
}
|
|
}
|
|
|
|
func (v ThirdPartyVettingStatus) IsValid() bool {
|
|
switch v {
|
|
case
|
|
ThirdPartyVettingStatusPending,
|
|
ThirdPartyVettingStatusProcessing,
|
|
ThirdPartyVettingStatusCompleted,
|
|
ThirdPartyVettingStatusFailed:
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func (v ThirdPartyVettingStatus) IsActive() bool {
|
|
switch v {
|
|
case ThirdPartyVettingStatusPending, ThirdPartyVettingStatusProcessing:
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func (v ThirdPartyVettingStatus) String() string {
|
|
return string(v)
|
|
}
|
|
|
|
func (v ThirdPartyVettingStatus) MarshalText() ([]byte, error) {
|
|
return []byte(v.String()), nil
|
|
}
|
|
|
|
func (v *ThirdPartyVettingStatus) UnmarshalText(text []byte) error {
|
|
val := ThirdPartyVettingStatus(text)
|
|
if !val.IsValid() {
|
|
return fmt.Errorf("invalid ThirdPartyVettingStatus value: %q", string(text))
|
|
}
|
|
|
|
*v = val
|
|
|
|
return nil
|
|
}
|