use {
    crate::{
        object::Version,
        wire::{JaySyncFileSurfaceId, jay_sync_file_surface::*},
        wl_usr::{UsrCon, usr_object::UsrObject},
    },
    std::{convert::Infallible, rc::Rc},
};

pub struct UsrJaySyncFileSurface {
    pub id: JaySyncFileSurfaceId,
    pub con: Rc<UsrCon>,
    pub version: Version,
}

impl JaySyncFileSurfaceEventHandler for UsrJaySyncFileSurface {
    type Error = Infallible;
}

usr_object_base! {
    self = UsrJaySyncFileSurface = JaySyncFileSurface;
    version = self.version;
}

impl UsrObject for UsrJaySyncFileSurface {
    fn destroy(&self) {
        self.con.request(Destroy { self_id: self.id });
    }
}
