package common

import "fmt"

// CertificateRequest schema
type CertificateRequest struct {
	CommonName      string `json:"common_name" validate:"required,max=100"`
	CertificateType string `json:"type" validate:"max=100"`
}

type CertificateRevokeRequest struct {
	Serial          string `json:"serial_number" validate:"required,serial,max=1000"`
	CertificateType string `json:"type" validate:"max=100"`
}

type CertificateRenewRequest struct {
	Type       string `json:"type" validate:"required,max=10000"`
	CommonName string `json:"common_name" validate:"max=100"`
}

type UpdateCert struct {
	SSLCertBase64 string `json:"ssl_cert_base64"`
}

type CertificateInstallRequest struct {
	VIN   string `pg:",pk" json:"vin" validate:"required,vin"`
	ICCID string `json:"iccid,omitempty" validate:"omitempty,max=50"`
}

func (c CertificateRequest) String() string {
	return fmt.Sprintf("CertificateRequest for Common Name<%s>", c.CommonName)
}
