use conjure_http::endpoint;
/// These endpoints are not intended to be used directly by clients, since
/// they require saving resource-specific state associated with new commits.
#[conjure_http::conjure_endpoints(
    name = "InternalVersioningService",
    use_legacy_error_serialization
)]
pub trait InternalVersioningService {
    /// Creates a root commit (no parents) and a "main" branch
    /// pointing to that commit, for the given resource.
    /// Throws if the resource already has a commit graph.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}",
        name = "initResourceVersioning",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn init_resource_versioning(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a non-permanent commit on the given branch,
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
        name = "saveWorkingState",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn save_working_state(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a new permanent commit on the given branch.
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
        name = "commit",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn commit(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CommitRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Compacts the commit graph for the resource by deleting
    /// working state commits that match the provided strategy.
    /// Persists commits that are pointed to by branches.
    /// Returns the set of commits that were compacted.
    /// Throws if the resource doesn't exist.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
        name = "compactCommits",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    fn compact_commits(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
    ) -> Result<
        std::collections::BTreeSet<
            super::super::super::objects::scout::versioning::api::CommitId,
        >,
        conjure_http::private::Error,
    >;
}
/// These endpoints are not intended to be used directly by clients, since
/// they require saving resource-specific state associated with new commits.
#[conjure_http::conjure_endpoints(
    name = "InternalVersioningService",
    use_legacy_error_serialization
)]
pub trait AsyncInternalVersioningService {
    /// Creates a root commit (no parents) and a "main" branch
    /// pointing to that commit, for the given resource.
    /// Throws if the resource already has a commit graph.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}",
        name = "initResourceVersioning",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn init_resource_versioning(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a non-permanent commit on the given branch,
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
        name = "saveWorkingState",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn save_working_state(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a new permanent commit on the given branch.
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
        name = "commit",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn commit(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CommitRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Compacts the commit graph for the resource by deleting
    /// working state commits that match the provided strategy.
    /// Persists commits that are pointed to by branches.
    /// Returns the set of commits that were compacted.
    /// Throws if the resource doesn't exist.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
        name = "compactCommits",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    async fn compact_commits(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
    ) -> Result<
        std::collections::BTreeSet<
            super::super::super::objects::scout::versioning::api::CommitId,
        >,
        conjure_http::private::Error,
    >;
}
/// These endpoints are not intended to be used directly by clients, since
/// they require saving resource-specific state associated with new commits.
#[conjure_http::conjure_endpoints(
    name = "InternalVersioningService",
    use_legacy_error_serialization,
    local
)]
pub trait LocalAsyncInternalVersioningService {
    /// Creates a root commit (no parents) and a "main" branch
    /// pointing to that commit, for the given resource.
    /// Throws if the resource already has a commit graph.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}",
        name = "initResourceVersioning",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn init_resource_versioning(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a non-permanent commit on the given branch,
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
        name = "saveWorkingState",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn save_working_state(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Creates a new permanent commit on the given branch.
    /// Throws if the branch doesn't exist.
    /// Throws if latestCommit is passed and is not the latest commit.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
        name = "commit",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn commit(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[path(
            name = "branchName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "branchName"
        )]
        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CommitRequest,
    ) -> Result<
        super::super::super::objects::scout::versioning::api::BranchAndCommit,
        conjure_http::private::Error,
    >;
    /// Compacts the commit graph for the resource by deleting
    /// working state commits that match the provided strategy.
    /// Persists commits that are pointed to by branches.
    /// Returns the set of commits that were compacted.
    /// Throws if the resource doesn't exist.
    #[endpoint(
        method = POST,
        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
        name = "compactCommits",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    async fn compact_commits(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "resourceRid",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "resourceRid"
        )]
        resource_rid: conjure_object::ResourceIdentifier,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
    ) -> Result<
        std::collections::BTreeSet<
            super::super::super::objects::scout::versioning::api::CommitId,
        >,
        conjure_http::private::Error,
    >;
}
