---
# System prepended metadata

title: 'Nom - Roles DNA ERD, Entry Structures, Validations'
tags: [Technical Specification]

---

# Nom - Roles DNA ERD, Entry Structures, Validations

###### tags: `Technical Specification`

### Diagram for Links/Paths/Entries

### Entries

#### Named Object Registration Entries
```rust=
pub struct Role {
    pub role_name: String,
    pub name_hash: EntryHash
}
// this neeeds to be countersigned
pub struct RoleAssignment {
    pub role: EntryHash,
    pub registration_hash: HoloHash<Dna>,
    pub agent_pub_key: AgentPubKey,
}

// this neeeds to be countersigned
pub struct RoleRevocation {
    pub role: EntryHash,
    pub registration_hash: HoloHash<Dna>,
    pub agent_pub_key: AgentPubKey,
}

#[hdk_entry]
// need a better name
struct NamedObjectRegistration {
    name: Vec<u8>,
    name_type: EntryHash,
    name_type_path: Vec<u8>,
    namespace: HoloHash<Entry>,
    created: Timestamp,
    coupon_data: NamedObjecCouponData
}

#[hdk_entry]
struct NamedObjectRegistrationProperties {
    registration_hash: EntryHash,
    maintainers: Vec<AgentPubKey>, // maintainers of this entry
    // roles: Vec<EntryHash>, // list of roles entry active
    client_app_authorized_agents: Vec<AgentPubKey> // 
    named_object_coupons: BtreeMap<u8, NamespaceCouponData>
}

struct NamedObjecCouponData {
    serial_number: Vec<u8>,
    namespace: HoloHash<EntryHash>,
    // This is fetch from the gateway node.
    // Which means that whatever "latest" version of
    // NameSpaceProperty was fetched from the
    // DHT will be used. This can work still in
    // case of network partisions but may make buyers
    // use older versions (in the perspective of the namespace owner) instead of the new one.
    name_type: EntryHash, // NameType spec that is the latest version (display price and ttl)
    payment_proof_sig: Signature
}
```