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

215 lines
5.5 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 AccessAuthorizationCreate type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AccessAuthorizationCreate{}
// AccessAuthorizationCreate struct for AccessAuthorizationCreate
type AccessAuthorizationCreate struct {
Name string `json:"name"`
IsActive bool `json:"is_active"`
Timetables []TimetableCreate `json:"timetables"`
}
type _AccessAuthorizationCreate AccessAuthorizationCreate
// NewAccessAuthorizationCreate instantiates a new AccessAuthorizationCreate 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 NewAccessAuthorizationCreate(name string, isActive bool, timetables []TimetableCreate) *AccessAuthorizationCreate {
this := AccessAuthorizationCreate{}
this.Name = name
this.IsActive = isActive
this.Timetables = timetables
return &this
}
// NewAccessAuthorizationCreateWithDefaults instantiates a new AccessAuthorizationCreate 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 NewAccessAuthorizationCreateWithDefaults() *AccessAuthorizationCreate {
this := AccessAuthorizationCreate{}
return &this
}
// GetName returns the Name field value
func (o *AccessAuthorizationCreate) 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 *AccessAuthorizationCreate) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *AccessAuthorizationCreate) SetName(v string) {
o.Name = v
}
// GetIsActive returns the IsActive field value
func (o *AccessAuthorizationCreate) 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 *AccessAuthorizationCreate) GetIsActiveOk() (*bool, bool) {
if o == nil {
return nil, false
}
return &o.IsActive, true
}
// SetIsActive sets field value
func (o *AccessAuthorizationCreate) SetIsActive(v bool) {
o.IsActive = v
}
// GetTimetables returns the Timetables field value
func (o *AccessAuthorizationCreate) GetTimetables() []TimetableCreate {
if o == nil {
var ret []TimetableCreate
return ret
}
return o.Timetables
}
// GetTimetablesOk returns a tuple with the Timetables field value
// and a boolean to check if the value has been set.
func (o *AccessAuthorizationCreate) GetTimetablesOk() ([]TimetableCreate, bool) {
if o == nil {
return nil, false
}
return o.Timetables, true
}
// SetTimetables sets field value
func (o *AccessAuthorizationCreate) SetTimetables(v []TimetableCreate) {
o.Timetables = v
}
func (o AccessAuthorizationCreate) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o AccessAuthorizationCreate) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
toSerialize["is_active"] = o.IsActive
toSerialize["timetables"] = o.Timetables
return toSerialize, nil
}
func (o *AccessAuthorizationCreate) 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",
"timetables",
}
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)
}
}
varAccessAuthorizationCreate := _AccessAuthorizationCreate{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varAccessAuthorizationCreate)
if err != nil {
return err
}
*o = AccessAuthorizationCreate(varAccessAuthorizationCreate)
return err
}
type NullableAccessAuthorizationCreate struct {
value *AccessAuthorizationCreate
isSet bool
}
func (v NullableAccessAuthorizationCreate) Get() *AccessAuthorizationCreate {
return v.value
}
func (v *NullableAccessAuthorizationCreate) Set(val *AccessAuthorizationCreate) {
v.value = val
v.isSet = true
}
func (v NullableAccessAuthorizationCreate) IsSet() bool {
return v.isSet
}
func (v *NullableAccessAuthorizationCreate) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccessAuthorizationCreate(val *AccessAuthorizationCreate) *NullableAccessAuthorizationCreate {
return &NullableAccessAuthorizationCreate{value: val, isSet: true}
}
func (v NullableAccessAuthorizationCreate) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccessAuthorizationCreate) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}