// Copyright 2024 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Code generated by thriftgo (0.3.15). DO NOT EDIT.

package entity

import (
	"database/sql"
	"database/sql/driver"
	"fmt"
	"github.com/cloudwego/thriftgo/extension/thrift_option"
)

type TestEnum int64

const (
	TestEnum_A TestEnum = 0
	TestEnum_B TestEnum = 1
	TestEnum_C TestEnum = 2
)

func (p TestEnum) String() string {
	switch p {
	case TestEnum_A:
		return "A"
	case TestEnum_B:
		return "B"
	case TestEnum_C:
		return "C"
	}
	return "<UNSET>"
}

func TestEnumFromString(s string) (TestEnum, error) {
	switch s {
	case "A":
		return TestEnum_A, nil
	case "B":
		return TestEnum_B, nil
	case "C":
		return TestEnum_C, nil
	}
	return TestEnum(0), fmt.Errorf("not a valid TestEnum string")
}

func TestEnumPtr(v TestEnum) *TestEnum { return &v }
func (p *TestEnum) Scan(value interface{}) (err error) {
	var result sql.NullInt64
	err = result.Scan(value)
	*p = TestEnum(result.Int64)
	return
}

func (p *TestEnum) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

type TestStructTypedef = InnerStruct

func NewTestStructTypedef() *TestStructTypedef {
	return (*TestStructTypedef)(NewInnerStruct())
}

type TestBasicTypedef = string

type _StructOptions struct {
	PersonBasicInfo     *PersonBasicInfo     `thrift:"person_basic_info,1,required" json:"person_basic_info"`
	PersonStructInfo    *PersonStructInfo    `thrift:"person_struct_info,2,required" json:"person_struct_info"`
	PersonContainerInfo *PersonContainerInfo `thrift:"person_container_info,3,required" json:"person_container_info"`
}

func New_StructOptions() *_StructOptions {
	return &_StructOptions{}
}

func (p *_StructOptions) InitDefault() {
}

var _StructOptions_PersonBasicInfo_DEFAULT *PersonBasicInfo

func (p *_StructOptions) GetPersonBasicInfo() (v *PersonBasicInfo) {
	if !p.IsSetPersonBasicInfo() {
		return _StructOptions_PersonBasicInfo_DEFAULT
	}
	return p.PersonBasicInfo
}

var _StructOptions_PersonStructInfo_DEFAULT *PersonStructInfo

func (p *_StructOptions) GetPersonStructInfo() (v *PersonStructInfo) {
	if !p.IsSetPersonStructInfo() {
		return _StructOptions_PersonStructInfo_DEFAULT
	}
	return p.PersonStructInfo
}

var _StructOptions_PersonContainerInfo_DEFAULT *PersonContainerInfo

func (p *_StructOptions) GetPersonContainerInfo() (v *PersonContainerInfo) {
	if !p.IsSetPersonContainerInfo() {
		return _StructOptions_PersonContainerInfo_DEFAULT
	}
	return p.PersonContainerInfo
}

func (p *_StructOptions) IsSetPersonBasicInfo() bool {
	return p.PersonBasicInfo != nil
}

func (p *_StructOptions) IsSetPersonStructInfo() bool {
	return p.PersonStructInfo != nil
}

func (p *_StructOptions) IsSetPersonContainerInfo() bool {
	return p.PersonContainerInfo != nil
}

func (p *_StructOptions) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("_StructOptions(%+v)", *p)
}

var fieldIDToName__StructOptions = map[int16]string{
	1: "person_basic_info",
	2: "person_struct_info",
	3: "person_container_info",
}

type _FieldOptions struct {
	PersonFieldInfo string `thrift:"person_field_info,1,required" json:"person_field_info"`
}

func New_FieldOptions() *_FieldOptions {
	return &_FieldOptions{}
}

func (p *_FieldOptions) InitDefault() {
}

func (p *_FieldOptions) GetPersonFieldInfo() (v string) {
	return p.PersonFieldInfo
}

func (p *_FieldOptions) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("_FieldOptions(%+v)", *p)
}

var fieldIDToName__FieldOptions = map[int16]string{
	1: "person_field_info",
}

type PersonBasicInfo struct {
	Valuei8     int8    `thrift:"valuei8,1,required" json:"valuei8"`
	Valuei16    int16   `thrift:"valuei16,2,required" json:"valuei16"`
	Valuei32    int32   `thrift:"valuei32,3,required" json:"valuei32"`
	Valuei64    int64   `thrift:"valuei64,4,required" json:"valuei64"`
	Valuestring string  `thrift:"valuestring,5,required" json:"valuestring"`
	Valuebyte   int8    `thrift:"valuebyte,6,required" json:"valuebyte"`
	Valuedouble float64 `thrift:"valuedouble,7,required" json:"valuedouble"`
	Valuebinary []byte  `thrift:"valuebinary,8,required" json:"valuebinary"`
	Valuebool   bool    `thrift:"valuebool,9,required" json:"valuebool"`
}

func NewPersonBasicInfo() *PersonBasicInfo {
	return &PersonBasicInfo{}
}

func (p *PersonBasicInfo) InitDefault() {
}

func (p *PersonBasicInfo) GetValuei8() (v int8) {
	return p.Valuei8
}

func (p *PersonBasicInfo) GetValuei16() (v int16) {
	return p.Valuei16
}

func (p *PersonBasicInfo) GetValuei32() (v int32) {
	return p.Valuei32
}

func (p *PersonBasicInfo) GetValuei64() (v int64) {
	return p.Valuei64
}

func (p *PersonBasicInfo) GetValuestring() (v string) {
	return p.Valuestring
}

func (p *PersonBasicInfo) GetValuebyte() (v int8) {
	return p.Valuebyte
}

func (p *PersonBasicInfo) GetValuedouble() (v float64) {
	return p.Valuedouble
}

func (p *PersonBasicInfo) GetValuebinary() (v []byte) {
	return p.Valuebinary
}

func (p *PersonBasicInfo) GetValuebool() (v bool) {
	return p.Valuebool
}

func (p *PersonBasicInfo) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("PersonBasicInfo(%+v)", *p)
}

var fieldIDToName_PersonBasicInfo = map[int16]string{
	1: "valuei8",
	2: "valuei16",
	3: "valuei32",
	4: "valuei64",
	5: "valuestring",
	6: "valuebyte",
	7: "valuedouble",
	8: "valuebinary",
	9: "valuebool",
}

type PersonContainerInfo struct {
	Valuemap           map[string]string       `thrift:"valuemap,1,required" json:"valuemap"`
	Valuelist          []string                `thrift:"valuelist,2,required" json:"valuelist"`
	Valueset           []string                `thrift:"valueset,3,required" json:"valueset"`
	Valuelistset       [][]string              `thrift:"valuelistset,4,required" json:"valuelistset"`
	Valuelistsetstruct [][]*InnerStruct        `thrift:"valuelistsetstruct,5,required" json:"valuelistsetstruct"`
	Valuemapstruct     map[string]*InnerStruct `thrift:"valuemapstruct,6,required" json:"valuemapstruct"`
}

func NewPersonContainerInfo() *PersonContainerInfo {
	return &PersonContainerInfo{}
}

func (p *PersonContainerInfo) InitDefault() {
}

func (p *PersonContainerInfo) GetValuemap() (v map[string]string) {
	return p.Valuemap
}

func (p *PersonContainerInfo) GetValuelist() (v []string) {
	return p.Valuelist
}

func (p *PersonContainerInfo) GetValueset() (v []string) {
	return p.Valueset
}

func (p *PersonContainerInfo) GetValuelistset() (v [][]string) {
	return p.Valuelistset
}

func (p *PersonContainerInfo) GetValuelistsetstruct() (v [][]*InnerStruct) {
	return p.Valuelistsetstruct
}

func (p *PersonContainerInfo) GetValuemapstruct() (v map[string]*InnerStruct) {
	return p.Valuemapstruct
}

func (p *PersonContainerInfo) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("PersonContainerInfo(%+v)", *p)
}

var fieldIDToName_PersonContainerInfo = map[int16]string{
	1: "valuemap",
	2: "valuelist",
	3: "valueset",
	4: "valuelistset",
	5: "valuelistsetstruct",
	6: "valuemapstruct",
}

type PersonStructInfo struct {
	Valueteststruct    *TestStruct        `thrift:"valueteststruct,1,required" json:"valueteststruct"`
	Valuestruct        *InnerStruct       `thrift:"valuestruct,2,required" json:"valuestruct"`
	Valueenum          TestEnum           `thrift:"valueenum,3,required" json:"valueenum"`
	Valuestructtypedef *TestStructTypedef `thrift:"valuestructtypedef,4,required" json:"valuestructtypedef"`
	Valuebasictypedef  TestBasicTypedef   `thrift:"valuebasictypedef,5,required" json:"valuebasictypedef"`
}

func NewPersonStructInfo() *PersonStructInfo {
	return &PersonStructInfo{}
}

func (p *PersonStructInfo) InitDefault() {
}

var PersonStructInfo_Valueteststruct_DEFAULT *TestStruct

func (p *PersonStructInfo) GetValueteststruct() (v *TestStruct) {
	if !p.IsSetValueteststruct() {
		return PersonStructInfo_Valueteststruct_DEFAULT
	}
	return p.Valueteststruct
}

var PersonStructInfo_Valuestruct_DEFAULT *InnerStruct

func (p *PersonStructInfo) GetValuestruct() (v *InnerStruct) {
	if !p.IsSetValuestruct() {
		return PersonStructInfo_Valuestruct_DEFAULT
	}
	return p.Valuestruct
}

func (p *PersonStructInfo) GetValueenum() (v TestEnum) {
	return p.Valueenum
}

var PersonStructInfo_Valuestructtypedef_DEFAULT *TestStructTypedef

func (p *PersonStructInfo) GetValuestructtypedef() (v *TestStructTypedef) {
	if !p.IsSetValuestructtypedef() {
		return PersonStructInfo_Valuestructtypedef_DEFAULT
	}
	return p.Valuestructtypedef
}

func (p *PersonStructInfo) GetValuebasictypedef() (v TestBasicTypedef) {
	return p.Valuebasictypedef
}

func (p *PersonStructInfo) IsSetValueteststruct() bool {
	return p.Valueteststruct != nil
}

func (p *PersonStructInfo) IsSetValuestruct() bool {
	return p.Valuestruct != nil
}

func (p *PersonStructInfo) IsSetValuestructtypedef() bool {
	return p.Valuestructtypedef != nil
}

func (p *PersonStructInfo) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("PersonStructInfo(%+v)", *p)
}

var fieldIDToName_PersonStructInfo = map[int16]string{
	1: "valueteststruct",
	2: "valuestruct",
	3: "valueenum",
	4: "valuestructtypedef",
	5: "valuebasictypedef",
}

type TestStruct struct {
	Name        string       `thrift:"name,1,required" json:"name"`
	Age         string       `thrift:"age,2,required" json:"age"`
	InnerStruct *InnerStruct `thrift:"innerStruct,3,required" json:"innerStruct"`
}

func NewTestStruct() *TestStruct {
	return &TestStruct{}
}

func (p *TestStruct) InitDefault() {
}

func (p *TestStruct) GetName() (v string) {
	return p.Name
}

func (p *TestStruct) GetAge() (v string) {
	return p.Age
}

var TestStruct_InnerStruct_DEFAULT *InnerStruct

func (p *TestStruct) GetInnerStruct() (v *InnerStruct) {
	if !p.IsSetInnerStruct() {
		return TestStruct_InnerStruct_DEFAULT
	}
	return p.InnerStruct
}

func (p *TestStruct) IsSetInnerStruct() bool {
	return p.InnerStruct != nil
}

func (p *TestStruct) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("TestStruct(%+v)", *p)
}

var fieldIDToName_TestStruct = map[int16]string{
	1: "name",
	2: "age",
	3: "innerStruct",
}
var (
	STRUCT_OPTION_PERSON_BASIC_INFO     = thrift_option.NewStructOption("../option_idl/annotations/entity/entity.thrift", "person_basic_info")
	STRUCT_OPTION_PERSON_STRUCT_INFO    = thrift_option.NewStructOption("../option_idl/annotations/entity/entity.thrift", "person_struct_info")
	STRUCT_OPTION_PERSON_CONTAINER_INFO = thrift_option.NewStructOption("../option_idl/annotations/entity/entity.thrift", "person_container_info")
	FIELD_OPTION_PERSON_FIELD_INFO      = thrift_option.NewFieldOption("../option_idl/annotations/entity/entity.thrift", "person_field_info")
)
