151 lines
6.1 KiB
Go
151 lines
6.1 KiB
Go
// Package model 定义 TCS-IPTV 的领域模型,
|
|
// 对应需求16的四类核心数据结构与 CTID 双锚定模型。
|
|
package model
|
|
|
|
import "time"
|
|
|
|
// Party 三方角色标识。
|
|
type Party string
|
|
|
|
const (
|
|
PartyCP Party = "cp" // 内容提供商
|
|
PartyReviewer Party = "reviewer" // 审核和监管部门(审核主体:CSPS/媒资库)
|
|
PartyOperator Party = "operator" // 运营商
|
|
)
|
|
|
|
// Content 内容主表(Content Registry)。
|
|
type Content struct {
|
|
ContentTwinID string `json:"content_twin_id"`
|
|
CCCode string `json:"ma_code"`
|
|
MAType string `json:"ma_type"`
|
|
Title string `json:"title"`
|
|
EpisodeCount int `json:"episode_count"`
|
|
Status string `json:"status"`
|
|
Issuer string `json:"issuer"`
|
|
IssueDate string `json:"issue_date"`
|
|
FileHash string `json:"file_hash,omitempty"` // 传输便利:列表时附带整剧文件哈希(供运营商演示注入)
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// HashType 哈希类型。
|
|
type HashType string
|
|
|
|
const (
|
|
HashFile HashType = "file_sha256"
|
|
HashPerceptual HashType = "perceptual"
|
|
HashTranscoded HashType = "transcoded"
|
|
)
|
|
|
|
// HashBinding 哈希绑定(Hash Binding)。
|
|
type HashBinding struct {
|
|
ContentTwinID string `json:"content_twin_id"`
|
|
HashType HashType `json:"hash_type"`
|
|
HashValue string `json:"hash_value"`
|
|
MerkleRoot string `json:"merkle_root"`
|
|
Episode int `json:"episode"` // 集号;0 表示整剧/单体(非分集)
|
|
FileFormat string `json:"file_format"`
|
|
Resolution string `json:"resolution"`
|
|
Duration int `json:"duration"`
|
|
Version string `json:"version"`
|
|
ParentHash string `json:"parent_hash"` // 转码版指向母版哈希
|
|
Revoked bool `json:"revoked"` // 集级下架标记(true=该集已下架)
|
|
RevokedReason string `json:"revoked_reason,omitempty"`
|
|
CreatedBy string `json:"created_by"`
|
|
}
|
|
|
|
// EpisodeHash 单集哈希(送审时按集提交)。
|
|
type EpisodeHash struct {
|
|
Episode int `json:"episode"`
|
|
FileSHA256 string `json:"file_sha256"`
|
|
MerkleRoot string `json:"merkle_root"`
|
|
Perceptual string `json:"perceptual_hash"`
|
|
Duration int `json:"duration"`
|
|
Resolution string `json:"resolution"`
|
|
}
|
|
|
|
// Mapping 三方编码映射(Identity Mapping)。
|
|
type Mapping struct {
|
|
ContentTwinID string `json:"content_twin_id"`
|
|
Party Party `json:"party"`
|
|
PartyID string `json:"party_id"`
|
|
PartyName string `json:"party_name"`
|
|
CDNEndpoint string `json:"cdn_endpoint"`
|
|
}
|
|
|
|
// VersionChange 版本变更(Version History)。
|
|
type VersionChange struct {
|
|
ContentTwinID string `json:"content_twin_id"`
|
|
Version string `json:"version"`
|
|
ChangeReason string `json:"change_reason"`
|
|
PrevHash string `json:"prev_hash"`
|
|
NewHash string `json:"new_hash"`
|
|
ReauditRequired bool `json:"reaudit_required"`
|
|
ReauditStatus string `json:"reaudit_status"`
|
|
AffectedEpisode int `json:"affected_episode"`
|
|
}
|
|
|
|
// 内容审核状态。
|
|
const (
|
|
StatusPending = "pending" // 待审
|
|
StatusPreChecking = "pre_checking" // 预检中
|
|
StatusReviewing = "reviewing" // CSPS 审核中
|
|
StatusApproved = "approved" // 审核通过(待发码)
|
|
StatusIssued = "issued" // 已发码(送审单完结)
|
|
StatusRejected = "rejected" // 驳回
|
|
StatusInLibrary = "in_library" // 已入媒资库
|
|
StatusPublished = "published" // 已发布
|
|
StatusRevoked = "revoked" // 已下架
|
|
StatusMerged = "merged" // 已合并入其他CC码
|
|
StatusSplit = "split" // 已拆分为多个CC码
|
|
)
|
|
|
|
// ContentQueryResult 多维度标识查询的统一返回结果。
|
|
// 支持按 Hash、省级内容编码、片库文件 ID 等多种维度反查内容标识信息。
|
|
type ContentQueryResult struct {
|
|
Found bool `json:"found"` // 是否找到匹配记录
|
|
Content Content `json:"content"` // 内容主记录
|
|
Bindings []HashBinding `json:"bindings"` // 哈希绑定列表
|
|
Mappings []Mapping `json:"mappings"` // 三方编码映射列表
|
|
}
|
|
|
|
// MergeRequest MA 合并请求(将多个 MA 码合并为一个主 MA 码)。
|
|
type MergeRequest struct {
|
|
PrimaryCCCode string `json:"primary_ma_code"` // 合并后保留的主 MA 码
|
|
SecondaryCCCodes []string `json:"secondary_ma_codes"` // 被合并的 MA 码列表(合并后标记为 merged)
|
|
Reason string `json:"reason"` // 合并原因
|
|
Operator string `json:"operator"` // 操作人
|
|
}
|
|
|
|
// MergeResult MA 合并结果。
|
|
type MergeResult struct {
|
|
PrimaryCCCode string `json:"primary_ma_code"` // 主 MA 码
|
|
MergedCCCodes []string `json:"merged_ma_codes"` // 已合并的 MA 码列表
|
|
MigratedBindings int `json:"migrated_bindings"` // 迁移的哈希绑定数
|
|
MigratedMappings int `json:"migrated_mappings"` // 迁移的映射数
|
|
TxID string `json:"tx_id"` // 链上交易 ID
|
|
}
|
|
|
|
// SplitRequest MA 拆分请求(将一个 MA 码拆分为多个独立 MA 码)。
|
|
type SplitRequest struct {
|
|
SourceCCCode string `json:"source_ma_code"` // 被拆分的源 MA 码
|
|
Splits []SplitTarget `json:"splits"` // 拆分目标列表
|
|
Reason string `json:"reason"` // 拆分原因
|
|
Operator string `json:"operator"` // 操作人
|
|
}
|
|
|
|
// SplitTarget 拆分目标:每集或每组内容拆分后的新 MA 码信息。
|
|
type SplitTarget struct {
|
|
NewCCCode string `json:"new_ma_code"` // 拆分后新分配的 MA 码
|
|
Title string `json:"title"` // 拆分后内容标题
|
|
Episodes []int `json:"episodes"` // 关联的集号列表(空表示整剧拆分)
|
|
}
|
|
|
|
// SplitResult MA 拆分结果。
|
|
type SplitResult struct {
|
|
SourceCCCode string `json:"source_ma_code"` // 源 MA 码
|
|
NewCCCodes []string `json:"new_ma_codes"` // 拆分后生成的新 MA 码列表
|
|
MigratedBindings int `json:"migrated_bindings"` // 迁移的哈希绑定数
|
|
MigratedMappings int `json:"migrated_mappings"` // 迁移的映射数
|
|
TxID string `json:"tx_id"` // 链上交易 ID
|
|
}
|