package device

import "github.com/google/uuid"

type EnrollRequest struct {
	Name              string `json:"name"`
	Platform          string `json:"platform"`
	OSVersion         string `json:"os_version"`
	AppVersion        string `json:"app_version"`
	DeviceFingerprint string `json:"device_fingerprint"`
	PublicKey         string `json:"public_key"`
}

type Device struct {
	ID         uuid.UUID `json:"id"`
	UserID     uuid.UUID `json:"user_id,omitempty"`
	GatewayID  uuid.UUID `json:"gateway_id,omitempty"`
	Name       string    `json:"name"`
	Platform   string    `json:"platform"`
	Status     string    `json:"status"`
	AssignedIP string    `json:"assigned_ip,omitempty"`
}

type ConnectionStatus struct {
	Status       string     `json:"status"`
	AssignedIP   string     `json:"assigned_ip"`
	LastSyncTime *string    `json:"last_sync_time"`
	Resources    []Resource `json:"resources"`
}

type Resource struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	Label string `json:"label"`
}

type EnrollmentResponse struct {
	Device    Device      `json:"device"`
	Peer      PeerView    `json:"peer"`
	Profile   ProfileView `json:"profile"`
	Resources []Resource  `json:"resources"`
}

type PeerView struct {
	AssignedIP      string      `json:"assigned_ip"`
	DNSServers      []string    `json:"dns_servers"`
	AllowedIPs      []string    `json:"allowed_ips"`
	Gateway         GatewayView `json:"gateway"`
	ProfileRevision int         `json:"profile_revision"`
}

type GatewayView struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	Endpoint  string    `json:"endpoint"`
	PublicKey string    `json:"public_key"`
}

type ProfileView struct {
	Format  string `json:"format"`
	Content string `json:"content"`
}
