/*
1Backend

AI-native microservices platform.

API version: 0.8.2
Contact: sales@singulatron.com
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package openapi

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the UserSvcHasPermissionResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UserSvcHasPermissionResponse{}

// UserSvcHasPermissionResponse struct for UserSvcHasPermissionResponse
type UserSvcHasPermissionResponse struct {
	App UserSvcApp `json:"app"`
	AppId string `json:"appId"`
	Authorized bool `json:"authorized"`
	Until string `json:"until"`
	User UserSvcUser `json:"user"`
}

type _UserSvcHasPermissionResponse UserSvcHasPermissionResponse

// NewUserSvcHasPermissionResponse instantiates a new UserSvcHasPermissionResponse 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 NewUserSvcHasPermissionResponse(app UserSvcApp, appId string, authorized bool, until string, user UserSvcUser) *UserSvcHasPermissionResponse {
	this := UserSvcHasPermissionResponse{}
	this.App = app
	this.AppId = appId
	this.Authorized = authorized
	this.Until = until
	this.User = user
	return &this
}

// NewUserSvcHasPermissionResponseWithDefaults instantiates a new UserSvcHasPermissionResponse 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 NewUserSvcHasPermissionResponseWithDefaults() *UserSvcHasPermissionResponse {
	this := UserSvcHasPermissionResponse{}
	return &this
}

// GetApp returns the App field value
func (o *UserSvcHasPermissionResponse) GetApp() UserSvcApp {
	if o == nil {
		var ret UserSvcApp
		return ret
	}

	return o.App
}

// GetAppOk returns a tuple with the App field value
// and a boolean to check if the value has been set.
func (o *UserSvcHasPermissionResponse) GetAppOk() (*UserSvcApp, bool) {
	if o == nil {
		return nil, false
	}
	return &o.App, true
}

// SetApp sets field value
func (o *UserSvcHasPermissionResponse) SetApp(v UserSvcApp) {
	o.App = v
}

// GetAppId returns the AppId field value
func (o *UserSvcHasPermissionResponse) GetAppId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.AppId
}

// GetAppIdOk returns a tuple with the AppId field value
// and a boolean to check if the value has been set.
func (o *UserSvcHasPermissionResponse) GetAppIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.AppId, true
}

// SetAppId sets field value
func (o *UserSvcHasPermissionResponse) SetAppId(v string) {
	o.AppId = v
}

// GetAuthorized returns the Authorized field value
func (o *UserSvcHasPermissionResponse) GetAuthorized() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.Authorized
}

// GetAuthorizedOk returns a tuple with the Authorized field value
// and a boolean to check if the value has been set.
func (o *UserSvcHasPermissionResponse) GetAuthorizedOk() (*bool, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Authorized, true
}

// SetAuthorized sets field value
func (o *UserSvcHasPermissionResponse) SetAuthorized(v bool) {
	o.Authorized = v
}

// GetUntil returns the Until field value
func (o *UserSvcHasPermissionResponse) GetUntil() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Until
}

// GetUntilOk returns a tuple with the Until field value
// and a boolean to check if the value has been set.
func (o *UserSvcHasPermissionResponse) GetUntilOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Until, true
}

// SetUntil sets field value
func (o *UserSvcHasPermissionResponse) SetUntil(v string) {
	o.Until = v
}

// GetUser returns the User field value
func (o *UserSvcHasPermissionResponse) GetUser() UserSvcUser {
	if o == nil {
		var ret UserSvcUser
		return ret
	}

	return o.User
}

// GetUserOk returns a tuple with the User field value
// and a boolean to check if the value has been set.
func (o *UserSvcHasPermissionResponse) GetUserOk() (*UserSvcUser, bool) {
	if o == nil {
		return nil, false
	}
	return &o.User, true
}

// SetUser sets field value
func (o *UserSvcHasPermissionResponse) SetUser(v UserSvcUser) {
	o.User = v
}

func (o UserSvcHasPermissionResponse) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o UserSvcHasPermissionResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["app"] = o.App
	toSerialize["appId"] = o.AppId
	toSerialize["authorized"] = o.Authorized
	toSerialize["until"] = o.Until
	toSerialize["user"] = o.User
	return toSerialize, nil
}

func (o *UserSvcHasPermissionResponse) 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{
		"app",
		"appId",
		"authorized",
		"until",
		"user",
	}

	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)
		}
	}

	varUserSvcHasPermissionResponse := _UserSvcHasPermissionResponse{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varUserSvcHasPermissionResponse)

	if err != nil {
		return err
	}

	*o = UserSvcHasPermissionResponse(varUserSvcHasPermissionResponse)

	return err
}

type NullableUserSvcHasPermissionResponse struct {
	value *UserSvcHasPermissionResponse
	isSet bool
}

func (v NullableUserSvcHasPermissionResponse) Get() *UserSvcHasPermissionResponse {
	return v.value
}

func (v *NullableUserSvcHasPermissionResponse) Set(val *UserSvcHasPermissionResponse) {
	v.value = val
	v.isSet = true
}

func (v NullableUserSvcHasPermissionResponse) IsSet() bool {
	return v.isSet
}

func (v *NullableUserSvcHasPermissionResponse) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableUserSvcHasPermissionResponse(val *UserSvcHasPermissionResponse) *NullableUserSvcHasPermissionResponse {
	return &NullableUserSvcHasPermissionResponse{value: val, isSet: true}
}

func (v NullableUserSvcHasPermissionResponse) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableUserSvcHasPermissionResponse) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


