package common

import (
	"fmt"

	"github.com/fiskerinc/cloud-services/pkg/common/dbbasemodel"
	"github.com/google/uuid"
)

type SubscriptionConfiguration struct {
	SubscriptionFeatureID uuid.UUID  `json:"feature_id,omitempty" pg:",pk,type:uuid" validate:"required"`
	ECU                   string     `json:"ecu" validate:"required,max=100" pg:",pk"`
	SoftwareVersion       string     `json:"sw_version" validate:"required,max=100"`
	HardwareVersion       string     `json:"hw_version" validate:"required,max=100"`
	Configuration         *BinaryHex `json:"configuration" validate:"required" swaggertype:"string" format:"hex" example:"9a1a6949d7f8a511df6e2e2771e444dbd6de97e7d98bdecbb5adc4b8965ce3bef353f523dbea123d7882dc043d415cda02810bad1b6f1b8c6202234a424b7d5b"`
	DID                   *BinaryHex `json:"did" validate:"required" swaggertype:"string" format:"hex" example:"7d5b"`
	PID                   *BinaryHex `json:"pid" validate:"required" swaggertype:"string" format:"hex" example:"7d5b"`
	Mask                  *BinaryHex `json:"mask" validate:"required" swaggertype:"string" format:"hex" example:"7d5b"`
	dbbasemodel.DBModelBase
}

func (sc *SubscriptionConfiguration) String() string {
	return fmt.Sprintf("SubscriptionConfiguration<%v %s>", sc.SubscriptionFeatureID, sc.ECU)
}
