// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::ffi;
use glib::{bitflags::bitflags, prelude::*, translate::*};

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GstTagLicenseFlags")]
    pub struct TagLicenseFlags: u32 {
        #[doc(alias = "GST_TAG_LICENSE_PERMITS_REPRODUCTION")]
        const PERMITS_REPRODUCTION = ffi::GST_TAG_LICENSE_PERMITS_REPRODUCTION as _;
        #[doc(alias = "GST_TAG_LICENSE_PERMITS_DISTRIBUTION")]
        const PERMITS_DISTRIBUTION = ffi::GST_TAG_LICENSE_PERMITS_DISTRIBUTION as _;
        #[doc(alias = "GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS")]
        const PERMITS_DERIVATIVE_WORKS = ffi::GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS as _;
        #[doc(alias = "GST_TAG_LICENSE_PERMITS_SHARING")]
        const PERMITS_SHARING = ffi::GST_TAG_LICENSE_PERMITS_SHARING as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_NOTICE")]
        const REQUIRES_NOTICE = ffi::GST_TAG_LICENSE_REQUIRES_NOTICE as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_ATTRIBUTION")]
        const REQUIRES_ATTRIBUTION = ffi::GST_TAG_LICENSE_REQUIRES_ATTRIBUTION as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE")]
        const REQUIRES_SHARE_ALIKE = ffi::GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_SOURCE_CODE")]
        const REQUIRES_SOURCE_CODE = ffi::GST_TAG_LICENSE_REQUIRES_SOURCE_CODE as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_COPYLEFT")]
        const REQUIRES_COPYLEFT = ffi::GST_TAG_LICENSE_REQUIRES_COPYLEFT as _;
        #[doc(alias = "GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT")]
        const REQUIRES_LESSER_COPYLEFT = ffi::GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT as _;
        #[doc(alias = "GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE")]
        const PROHIBITS_COMMERCIAL_USE = ffi::GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE as _;
        #[doc(alias = "GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE")]
        const PROHIBITS_HIGH_INCOME_NATION_USE = ffi::GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE as _;
        #[doc(alias = "GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE")]
        const CREATIVE_COMMONS_LICENSE = ffi::GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE as _;
        #[doc(alias = "GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE")]
        const FREE_SOFTWARE_FOUNDATION_LICENSE = ffi::GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE as _;
    }
}

#[doc(hidden)]
impl IntoGlib for TagLicenseFlags {
    type GlibType = ffi::GstTagLicenseFlags;

    #[inline]
    fn into_glib(self) -> ffi::GstTagLicenseFlags {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::GstTagLicenseFlags> for TagLicenseFlags {
    #[inline]
    unsafe fn from_glib(value: ffi::GstTagLicenseFlags) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for TagLicenseFlags {
    #[inline]
    #[doc(alias = "gst_tag_license_flags_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::gst_tag_license_flags_get_type()) }
    }
}

impl glib::HasParamSpec for TagLicenseFlags {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for TagLicenseFlags {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for TagLicenseFlags {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        unsafe { from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) }
    }
}

impl ToValue for TagLicenseFlags {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<TagLicenseFlags> for glib::Value {
    #[inline]
    fn from(v: TagLicenseFlags) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}
