github.com/readium/readium-lcp-server@v0.0.0-20240509124024-799e77a0bbd6/license_statuses/license_status.go (about)

     1  // Copyright 2020 Readium Foundation. All rights reserved.
     2  // Use of this source code is governed by a BSD-style license
     3  // that can be found in the LICENSE file exposed on Github (readium) in the project repository.
     4  
     5  package licensestatuses
     6  
     7  import (
     8  	"time"
     9  
    10  	"github.com/readium/readium-lcp-server/transactions"
    11  )
    12  
    13  // Updated represents license and status document timestamps
    14  type Updated struct {
    15  	License *time.Time `json:"license,omitempty"`
    16  	Status  *time.Time `json:"status,omitempty"`
    17  }
    18  
    19  // Link represents a link object
    20  type Link struct {
    21  	Rel       string `json:"rel"`
    22  	Href      string `json:"href"`
    23  	Type      string `json:"type,omitempty"`
    24  	Title     string `json:"title,omitempty"`
    25  	Profile   string `json:"profile,omitempty"`
    26  	Templated bool   `json:"templated,omitempty"`
    27  }
    28  
    29  // PotentialRights represents the maximal extension time of a loan
    30  type PotentialRights struct {
    31  	End *time.Time `json:"end,omitempty"`
    32  }
    33  
    34  // LicenseStatus represents a license status
    35  type LicenseStatus struct {
    36  	ID                int                  `json:"-"`
    37  	LicenseRef        string               `json:"id"`
    38  	Status            string               `json:"status"`
    39  	Updated           *Updated             `json:"updated,omitempty"`
    40  	Message           string               `json:"message"`
    41  	Links             []Link               `json:"links,omitempty"`
    42  	DeviceCount       *int                 `json:"device_count,omitempty"`
    43  	PotentialRights   *PotentialRights     `json:"potential_rights,omitempty"`
    44  	Events            []transactions.Event `json:"events,omitempty"`
    45  	CurrentEndLicense *time.Time           `json:"-"`
    46  }