package {{ $.Package }}

{{- if $.Imports }}

import (
	{{- range $import := $.Imports }}
	{{$import.Name}} "{{$import.Path}}"
	{{- end }}
)
{{- end }}

// Controller for {{ $.Plural }}
type Controller struct {
}

// {{ $.Struct }} struct
type {{ $.Struct }} struct {
	ID int `json:"id"`
}

{{- range $action := $.Actions }}
{{/* Index action */}}
{{- if $action.Index }}

// Index of {{ $.Plural }}
// GET {{ $action.Route }}
func (c *Controller) Index(ctx context.Context) ({{ $action.Result }} []*{{ $.Struct }}, err error) {
	return []*{{ $.Struct }}{}, nil
}

{{/* New action */}}
{{- else if $action.New }}

// New returns a view for creating a new {{ $.Singular }}
// GET {{ $action.Route }}
func (c *Controller) New(ctx context.Context) {
}

{{/* Create action */}}
{{- else if $action.Create }}

// Create {{ $.Singular }}
// POST {{ $action.Route }}
func (c *Controller) Create(ctx context.Context) ({{ $action.Result }} *{{ $.Struct }}, err error) {
	return &{{ $.Struct }}{
		ID: 0,
	}, nil
}

{{/* Show action */}}
{{- else if $action.Show }}

// Show {{ $.Singular }}
// GET {{ $action.Route }}
func (c *Controller) Show(ctx context.Context, id int) ({{ $action.Result }} *{{ $.Struct }}, err error) {
	return &{{ $.Struct }}{
		ID: id,
	}, nil
}

{{/* Edit action */}}
{{- else if $action.Edit }}

// Edit returns a view for editing a {{ $.Singular }}
// GET {{ $action.Route }}
func (c *Controller) Edit(ctx context.Context, id int) ({{ $action.Result }} *{{ $.Struct }}, err error) {
	return &{{ $.Struct }}{
		ID: id,
	}, nil
}

{{/* Update action */}}
{{- else if $action.Update }}

// Update {{ $.Singular }}
// PATCH {{ $action.Route }}
func (c *Controller) Update(ctx context.Context, id int) ({{ $action.Result }} *{{ $.Struct }}, err error) {
	return &{{ $.Struct }}{
		ID: id,
	}, nil
}

{{/* Delete action */}}
{{- else if $action.Delete }}

// Delete {{ $.Singular }}
// DELETE {{ $action.Route }}
func (c *Controller) Delete(ctx context.Context, id int) error {
	return nil
}

{{- end }}
{{- end }}