// Code generated by Fern. DO NOT EDIT.

package Lattice

import (
	json "encoding/json"
	core "github.com/anduril/lattice-sdk-go/v2/core"
)

// Bad request
type BadRequestError struct {
	*core.APIError
	Body interface{}
}

func (b *BadRequestError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	b.StatusCode = 400
	b.Body = body
	return nil
}

func (b *BadRequestError) MarshalJSON() ([]byte, error) {
	return json.Marshal(b.Body)
}

func (b *BadRequestError) Unwrap() error {
	return b.APIError
}

// Content too large
type ContentTooLargeError struct {
	*core.APIError
	Body interface{}
}

func (c *ContentTooLargeError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	c.StatusCode = 413
	c.Body = body
	return nil
}

func (c *ContentTooLargeError) MarshalJSON() ([]byte, error) {
	return json.Marshal(c.Body)
}

func (c *ContentTooLargeError) Unwrap() error {
	return c.APIError
}

// Insuccifient Storage
type InsufficientStorageError struct {
	*core.APIError
	Body interface{}
}

func (i *InsufficientStorageError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	i.StatusCode = 507
	i.Body = body
	return nil
}

func (i *InsufficientStorageError) MarshalJSON() ([]byte, error) {
	return json.Marshal(i.Body)
}

func (i *InsufficientStorageError) Unwrap() error {
	return i.APIError
}

// Internal server error
type InternalServerError struct {
	*core.APIError
	Body interface{}
}

func (i *InternalServerError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	i.StatusCode = 500
	i.Body = body
	return nil
}

func (i *InternalServerError) MarshalJSON() ([]byte, error) {
	return json.Marshal(i.Body)
}

func (i *InternalServerError) Unwrap() error {
	return i.APIError
}

// The specified resource was not found
type NotFoundError struct {
	*core.APIError
	Body interface{}
}

func (n *NotFoundError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	n.StatusCode = 404
	n.Body = body
	return nil
}

func (n *NotFoundError) MarshalJSON() ([]byte, error) {
	return json.Marshal(n.Body)
}

func (n *NotFoundError) Unwrap() error {
	return n.APIError
}

// The server has terminated the session. The server will send this error when the client has fallen too far
// behind in processing entity events. If the server sends this error, then the session token is invalid and a
// new session must be initiated to receive entity events.
type RequestTimeoutError struct {
	*core.APIError
	Body interface{}
}

func (r *RequestTimeoutError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	r.StatusCode = 408
	r.Body = body
	return nil
}

func (r *RequestTimeoutError) MarshalJSON() ([]byte, error) {
	return json.Marshal(r.Body)
}

func (r *RequestTimeoutError) Unwrap() error {
	return r.APIError
}

// Server is out of resources or reaching rate limiting or quota and cannot accept the request at this time.
type TooManyRequestsError struct {
	*core.APIError
	Body interface{}
}

func (t *TooManyRequestsError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	t.StatusCode = 429
	t.Body = body
	return nil
}

func (t *TooManyRequestsError) MarshalJSON() ([]byte, error) {
	return json.Marshal(t.Body)
}

func (t *TooManyRequestsError) Unwrap() error {
	return t.APIError
}

// Unauthorized to access resource
type UnauthorizedError struct {
	*core.APIError
	Body interface{}
}

func (u *UnauthorizedError) UnmarshalJSON(data []byte) error {
	var body interface{}
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	u.StatusCode = 401
	u.Body = body
	return nil
}

func (u *UnauthorizedError) MarshalJSON() ([]byte, error) {
	return json.Marshal(u.Body)
}

func (u *UnauthorizedError) Unwrap() error {
	return u.APIError
}
