package dto

import "wucher/internal/domain/land"

// JSON:API Land DTOs

type LandAttributes struct {
	Name              string                `json:"name" example:"Germany"`
	Note              string                `json:"note,omitempty" example:"Central Europe"`
	ISOCode           string                `json:"iso_code,omitempty" example:"DE"`
	BMDExportID       *string               `json:"bmd_export_id,omitempty" example:"DE001"`
	FederalStateTotal int                   `json:"federal_state_total" example:"2"`
	FederalStateList  []LandFederalStateDTO `json:"federal_state_list,omitempty"`
	SortKey           *int                  `json:"sortkey" example:"1"`
	IsActive          bool                  `json:"is_active" example:"true"`
	CreatedAt         string                `json:"created_at,omitempty" example:"2026-03-12T03:04:05Z"`
	CreatedBy         string                `json:"created_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	UpdatedAt         string                `json:"updated_at,omitempty" example:"2026-03-12T03:04:05Z"`
	UpdatedBy         string                `json:"updated_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	DeletedAt         string                `json:"deleted_at,omitempty" example:"2026-03-12T03:04:05Z"`
	DeletedBy         string                `json:"deleted_by,omitempty" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
}

type LandFederalStateDTO struct {
	ID   string `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Name string `json:"name" example:"Bayern"`
}

type LandFederalStateView struct {
	ID   []byte
	Name string
}

type LandView struct {
	Row               land.Land
	FederalStateTotal int
	FederalStateList  []LandFederalStateView
}

type LandResource struct {
	Type       string         `json:"type" example:"land"`
	ID         string         `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes LandAttributes `json:"attributes"`
}

type LandResponse struct {
	Data LandResource `json:"data"`
}

type LandListResponse struct {
	Data []LandResource `json:"data"`
	Meta struct {
		PageNumber int   `json:"page_number" example:"1"`
		PageSize   int   `json:"page_size" example:"20"`
		Total      int64 `json:"total" example:"120"`
	} `json:"meta"`
}

type LandDataTableResponse struct {
	Data []LandResource `json:"data"`
	Meta struct {
		Draw            int   `json:"draw" example:"1"`
		RecordsTotal    int64 `json:"records_total" example:"120"`
		RecordsFiltered int64 `json:"records_filtered" example:"12"`
	} `json:"meta"`
}

type LandCreateAttributes struct {
	Name        string  `json:"name" validate:"required" example:"Germany"`
	Note        *string `json:"note,omitempty" example:"Central Europe"`
	ISOCode     string  `json:"iso_code,omitempty" example:"DE"`
	BMDExportID *string `json:"bmd_export_id,omitempty" example:"DE001"`
	SortKey     *int    `json:"sortkey" example:"1"`
	IsActive    *bool   `json:"is_active,omitempty" example:"true"`
}

type LandCreateData struct {
	Type       string               `json:"type" validate:"required,oneof=land_create land" example:"land_create"`
	Attributes LandCreateAttributes `json:"attributes" validate:"required"`
}

type LandCreateRequest struct {
	Data LandCreateData `json:"data" validate:"required"`
}

type LandUpdateAttributes struct {
	Name        *string `json:"name,omitempty" example:"Germany"`
	Note        *string `json:"note,omitempty" example:"Central Europe"`
	ISOCode     *string `json:"iso_code,omitempty" example:"DE"`
	BMDExportID *string `json:"bmd_export_id,omitempty" example:"DE001"`
	SortKey     NullInt `json:"sortkey,omitempty" swaggertype:"integer" example:"1"`
	IsActive    *bool   `json:"is_active,omitempty" example:"true"`
}

type LandUpdateData struct {
	Type       string               `json:"type" validate:"required,oneof=land_update land" example:"land_update"`
	ID         string               `json:"id" example:"018f3a5c-7a6f-7c2a-8d4a-4b5b1f6c8e9d"`
	Attributes LandUpdateAttributes `json:"attributes" validate:"required"`
}

type LandUpdateRequest struct {
	Data LandUpdateData `json:"data" validate:"required"`
}
