package models

import "time"

// WOPICheckFileInfoResponse represents the response to WOPI CheckFileInfo request
// Reference: https://docs.microsoft.com/en-us/openspecs/office_protocols/ms-wopi/4b8ffc3f-e8a6-4169-8c4e-34924ac6ae2f
type WOPICheckFileInfoResponse struct {
	BaseFileName                   string   `json:"BaseFileName"`
	Size                           int64    `json:"Size"`
	Version                        string   `json:"Version"`
	OwnerId                        string   `json:"OwnerId"`
	UserId                         string   `json:"UserId"`
	UserFriendlyName               string   `json:"UserFriendlyName"`
	UserCanWrite                   bool     `json:"UserCanWrite"`
	UserCanRename                  bool     `json:"UserCanRename"`
	UserCanNotWriteRelative        bool     `json:"UserCanNotWriteRelative"`
	ReadOnly                       bool     `json:"ReadOnly"`
	RestrictedWebViewOnly          bool     `json:"RestrictedWebViewOnly"`
	UserCanCreateRelativeToFolder  bool     `json:"UserCanCreateRelativeToFolder"`
	EnableOwnerTermination         bool     `json:"EnableOwnerTermination"`
	SupportsUpdate                 bool     `json:"SupportsUpdate"`
	SupportsCobalt                 bool     `json:"SupportsCobalt"`
	SupportsLocks                  bool     `json:"SupportsLocks"`
	SupportsExtendedLockLength     bool     `json:"SupportsExtendedLockLength"`
	SupportsGetLock                bool     `json:"SupportsGetLock"`
	SupportsDelete                 bool     `json:"SupportsDelete"`
	SupportsRename                 bool     `json:"SupportsRename"`
	SupportsRenameRelativeToFolder bool     `json:"SupportsRenameRelativeToFolder"`
	SupportsFolders                bool     `json:"SupportsFolders"`
	SupportsScenarios              []string `json:"SupportsScenarios"`
	LastModifiedTime               string   `json:"LastModifiedTime"`
	IsAnonymousUser                bool     `json:"IsAnonymousUser"`
	TimeZone                       string   `json:"TimeZone"`
	CloseUrl                       string   `json:"CloseUrl,omitempty"`
	EditUrl                        string   `json:"EditUrl,omitempty"`
	ViewUrl                        string   `json:"ViewUrl,omitempty"`
	FileSharingUrl                 string   `json:"FileSharingUrl,omitempty"`
	DownloadUrl                    string   `json:"DownloadUrl,omitempty"`
}

// WOPIPutFileResponse represents the response to WOPI PutFile request
type WOPIPutFileResponse struct {
	ItemVersion string `json:"ItemVersion"`
}

// WOPILockInfo represents information about a file lock
type WOPILockInfo struct {
	FileID    string    `json:"file_id"`
	UserID    string    `json:"user_id"`
	LockID    string    `json:"lock_id"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

// WOPIAccessTokenRequest represents a request to get WOPI access token
type WOPIAccessTokenRequest struct {
	FileID string `json:"file_id"`
}

// WOPIAccessTokenResponse represents a response with WOPI access token
type WOPIAccessTokenResponse struct {
	AccessToken      string `json:"access_token"`
	AccessTokenTTL   int64  `json:"access_token_ttl"`
	BootstrapperUrl  string `json:"bootstrapper_url,omitempty"`
	ClosePostMessage bool   `json:"close_post_message"`
}

// WOPISessionResponse represents a response for creating a WOPI session
type WOPISessionResponse struct {
	WOPISrc     string `json:"wopi_src"`
	AccessToken string `json:"access_token"`
}
