package common

import "time"

type AddIssueRequest struct {
	Issue
	Images [][]byte `json:"images"`
}

type Issue struct {
	ID          int          `json:"id" pg:",pk"`
	VIN         string       `json:"vin" pg:"vin" validate:"required,vin"`
	Title       string       `json:"title" pg:"title" validate:"required,max=256"`
	Description string       `json:"description" pg:"description" validate:"required,max=1024"`
	DriverID    string       `json:"driver_id,omitempty" pg:"driver_id"`
	Timestamp   time.Time    `json:"timestamp" validate:"required" pg:"created_at"`
	IssueImages []IssueImage `json:"images,omitempty" pg:"rel:has-many"`
}

type IssueImage struct {
	ID      int    `json:"id" pg:",pk"`
	Image   []byte `json:"image" pg:"image"`
	IssueID int    `json:"issue_id" pg:"issue_id"`
}

type IssueSearch struct {
	Search string `json:"search" validate:"max=1024"`
}
