Files
portal/openapi/model_access_authorization_db.go
2026-06-22 11:38:29 +02:00

233 lines
5.8 KiB
Go

/*
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: 0.1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the AccessAuthorizationDB type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AccessAuthorizationDB{}
// AccessAuthorizationDB struct for AccessAuthorizationDB
type AccessAuthorizationDB struct {
Name string `json:"name"`
IsActive bool `json:"is_active"`
Id NullableInt32 `json:"id,omitempty"`
}
type _AccessAuthorizationDB AccessAuthorizationDB
// NewAccessAuthorizationDB instantiates a new AccessAuthorizationDB object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewAccessAuthorizationDB(name string, isActive bool) *AccessAuthorizationDB {
this := AccessAuthorizationDB{}
this.Name = name
this.IsActive = isActive
return &this
}
// NewAccessAuthorizationDBWithDefaults instantiates a new AccessAuthorizationDB object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewAccessAuthorizationDBWithDefaults() *AccessAuthorizationDB {
this := AccessAuthorizationDB{}
return &this
}
// GetName returns the Name field value
func (o *AccessAuthorizationDB) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *AccessAuthorizationDB) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *AccessAuthorizationDB) SetName(v string) {
o.Name = v
}
// GetIsActive returns the IsActive field value
func (o *AccessAuthorizationDB) GetIsActive() bool {
if o == nil {
var ret bool
return ret
}
return o.IsActive
}
// GetIsActiveOk returns a tuple with the IsActive field value
// and a boolean to check if the value has been set.
func (o *AccessAuthorizationDB) GetIsActiveOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.IsActive, true
}
// SetIsActive sets field value
func (o *AccessAuthorizationDB) SetIsActive(v bool) {
o.IsActive = v
}
// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *AccessAuthorizationDB) GetId() int32 {
if o == nil || IsNil(o.Id.Get()) {
var ret int32
return ret
}
return *o.Id.Get()
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *AccessAuthorizationDB) GetIdOk() (*int32, bool) {
if o == nil {
return nil, false
}
return o.Id.Get(), o.Id.IsSet()
}
// HasId returns a boolean if a field has been set.
func (o *AccessAuthorizationDB) HasId() bool {
if o != nil && o.Id.IsSet() {
return true
}
return false
}
// SetId gets a reference to the given NullableInt32 and assigns it to the Id field.
func (o *AccessAuthorizationDB) SetId(v int32) {
o.Id.Set(&v)
}
// SetIdNil sets the value for Id to be an explicit nil
func (o *AccessAuthorizationDB) SetIdNil() {
o.Id.Set(nil)
}
// UnsetId ensures that no value is present for Id, not even an explicit nil
func (o *AccessAuthorizationDB) UnsetId() {
o.Id.Unset()
}
func (o AccessAuthorizationDB) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AccessAuthorizationDB) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
toSerialize["is_active"] = o.IsActive
if o.Id.IsSet() {
toSerialize["id"] = o.Id.Get()
}
return toSerialize, nil
}
func (o *AccessAuthorizationDB) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"name",
"is_active",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varAccessAuthorizationDB := _AccessAuthorizationDB{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varAccessAuthorizationDB)
if err != nil {
return err
}
*o = AccessAuthorizationDB(varAccessAuthorizationDB)
return err
}
type NullableAccessAuthorizationDB struct {
value *AccessAuthorizationDB
isSet bool
}
func (v NullableAccessAuthorizationDB) Get() *AccessAuthorizationDB {
return v.value
}
func (v *NullableAccessAuthorizationDB) Set(val *AccessAuthorizationDB) {
v.value = val
v.isSet = true
}
func (v NullableAccessAuthorizationDB) IsSet() bool {
return v.isSet
}
func (v *NullableAccessAuthorizationDB) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccessAuthorizationDB(val *AccessAuthorizationDB) *NullableAccessAuthorizationDB {
return &NullableAccessAuthorizationDB{value: val, isSet: true}
}
func (v NullableAccessAuthorizationDB) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccessAuthorizationDB) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}