/*
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 UserSvcPermitInput type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UserSvcPermitInput{}

// UserSvcPermitInput struct for UserSvcPermitInput
type UserSvcPermitInput struct {
	// App of the permit. Use `*` to match all apps, such as when bootstrapping in services.
	AppHost *string `json:"appHost,omitempty"`
	Id *string `json:"id,omitempty"`
	Permission string `json:"permission"`
	// Role IDs that have been permited the specified permission.  Originally, permits were designed for slugs to facilitate service-to-service calls. Due to their convenience—especially with CLI and infrastructure-as-code support—they were later extended to roles.
	Roles []string `json:"roles,omitempty"`
	// Slugs that have been permited the specified permission.
	Slugs []string `json:"slugs,omitempty"`
}

type _UserSvcPermitInput UserSvcPermitInput

// NewUserSvcPermitInput instantiates a new UserSvcPermitInput 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 NewUserSvcPermitInput(permission string) *UserSvcPermitInput {
	this := UserSvcPermitInput{}
	this.Permission = permission
	return &this
}

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

// GetAppHost returns the AppHost field value if set, zero value otherwise.
func (o *UserSvcPermitInput) GetAppHost() string {
	if o == nil || IsNil(o.AppHost) {
		var ret string
		return ret
	}
	return *o.AppHost
}

// GetAppHostOk returns a tuple with the AppHost field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcPermitInput) GetAppHostOk() (*string, bool) {
	if o == nil || IsNil(o.AppHost) {
		return nil, false
	}
	return o.AppHost, true
}

// HasAppHost returns a boolean if a field has been set.
func (o *UserSvcPermitInput) HasAppHost() bool {
	if o != nil && !IsNil(o.AppHost) {
		return true
	}

	return false
}

// SetAppHost gets a reference to the given string and assigns it to the AppHost field.
func (o *UserSvcPermitInput) SetAppHost(v string) {
	o.AppHost = &v
}

// GetId returns the Id field value if set, zero value otherwise.
func (o *UserSvcPermitInput) GetId() string {
	if o == nil || IsNil(o.Id) {
		var ret string
		return ret
	}
	return *o.Id
}

// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcPermitInput) GetIdOk() (*string, bool) {
	if o == nil || IsNil(o.Id) {
		return nil, false
	}
	return o.Id, true
}

// HasId returns a boolean if a field has been set.
func (o *UserSvcPermitInput) HasId() bool {
	if o != nil && !IsNil(o.Id) {
		return true
	}

	return false
}

// SetId gets a reference to the given string and assigns it to the Id field.
func (o *UserSvcPermitInput) SetId(v string) {
	o.Id = &v
}

// GetPermission returns the Permission field value
func (o *UserSvcPermitInput) GetPermission() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Permission
}

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

// SetPermission sets field value
func (o *UserSvcPermitInput) SetPermission(v string) {
	o.Permission = v
}

// GetRoles returns the Roles field value if set, zero value otherwise.
func (o *UserSvcPermitInput) GetRoles() []string {
	if o == nil || IsNil(o.Roles) {
		var ret []string
		return ret
	}
	return o.Roles
}

// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcPermitInput) GetRolesOk() ([]string, bool) {
	if o == nil || IsNil(o.Roles) {
		return nil, false
	}
	return o.Roles, true
}

// HasRoles returns a boolean if a field has been set.
func (o *UserSvcPermitInput) HasRoles() bool {
	if o != nil && !IsNil(o.Roles) {
		return true
	}

	return false
}

// SetRoles gets a reference to the given []string and assigns it to the Roles field.
func (o *UserSvcPermitInput) SetRoles(v []string) {
	o.Roles = v
}

// GetSlugs returns the Slugs field value if set, zero value otherwise.
func (o *UserSvcPermitInput) GetSlugs() []string {
	if o == nil || IsNil(o.Slugs) {
		var ret []string
		return ret
	}
	return o.Slugs
}

// GetSlugsOk returns a tuple with the Slugs field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserSvcPermitInput) GetSlugsOk() ([]string, bool) {
	if o == nil || IsNil(o.Slugs) {
		return nil, false
	}
	return o.Slugs, true
}

// HasSlugs returns a boolean if a field has been set.
func (o *UserSvcPermitInput) HasSlugs() bool {
	if o != nil && !IsNil(o.Slugs) {
		return true
	}

	return false
}

// SetSlugs gets a reference to the given []string and assigns it to the Slugs field.
func (o *UserSvcPermitInput) SetSlugs(v []string) {
	o.Slugs = v
}

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

func (o UserSvcPermitInput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.AppHost) {
		toSerialize["appHost"] = o.AppHost
	}
	if !IsNil(o.Id) {
		toSerialize["id"] = o.Id
	}
	toSerialize["permission"] = o.Permission
	if !IsNil(o.Roles) {
		toSerialize["roles"] = o.Roles
	}
	if !IsNil(o.Slugs) {
		toSerialize["slugs"] = o.Slugs
	}
	return toSerialize, nil
}

func (o *UserSvcPermitInput) 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{
		"permission",
	}

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

	varUserSvcPermitInput := _UserSvcPermitInput{}

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

	if err != nil {
		return err
	}

	*o = UserSvcPermitInput(varUserSvcPermitInput)

	return err
}

type NullableUserSvcPermitInput struct {
	value *UserSvcPermitInput
	isSet bool
}

func (v NullableUserSvcPermitInput) Get() *UserSvcPermitInput {
	return v.value
}

func (v *NullableUserSvcPermitInput) Set(val *UserSvcPermitInput) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUserSvcPermitInput(val *UserSvcPermitInput) *NullableUserSvcPermitInput {
	return &NullableUserSvcPermitInput{value: val, isSet: true}
}

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

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


