// Copyright (C) 2025-2026 Michael S. Klishin and Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Creation(pub u32);

impl Creation {
    pub fn new(value: u32) -> Self {
        Self(value)
    }

    pub fn value(&self) -> u32 {
        self.0
    }
}

impl From<u32> for Creation {
    fn from(value: u32) -> Self {
        Creation(value)
    }
}

impl From<Creation> for u32 {
    fn from(creation: Creation) -> Self {
        creation.0
    }
}

impl Default for Creation {
    fn default() -> Self {
        Creation(1)
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SequenceId(pub u64);

impl SequenceId {
    pub fn new(value: u64) -> Self {
        Self(value)
    }

    pub fn value(&self) -> u64 {
        self.0
    }
}

impl From<u64> for SequenceId {
    fn from(value: u64) -> Self {
        SequenceId(value)
    }
}

impl From<SequenceId> for u64 {
    fn from(seq_id: SequenceId) -> Self {
        seq_id.0
    }
}
