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

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

glib::wrapper! {
    #[doc(alias = "ShumateCoordinate")]
    pub struct Coordinate(Object<ffi::ShumateCoordinate, ffi::ShumateCoordinateClass>) @implements Location;

    match fn {
        type_ => || ffi::shumate_coordinate_get_type(),
    }
}

impl Coordinate {
    pub const NONE: Option<&'static Coordinate> = None;

    #[doc(alias = "shumate_coordinate_new")]
    pub fn new() -> Coordinate {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::shumate_coordinate_new()) }
    }

    #[doc(alias = "shumate_coordinate_new_full")]
    pub fn new_full(latitude: f64, longitude: f64) -> Coordinate {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::shumate_coordinate_new_full(latitude, longitude)) }
    }

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`Coordinate`] objects.
    ///
    /// This method returns an instance of [`CoordinateBuilder`](crate::builders::CoordinateBuilder) which can be used to create [`Coordinate`] objects.
    pub fn builder() -> CoordinateBuilder {
        CoordinateBuilder::new()
    }
}

impl Default for Coordinate {
    fn default() -> Self {
        Self::new()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`Coordinate`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct CoordinateBuilder {
    builder: glib::object::ObjectBuilder<'static, Coordinate>,
}

impl CoordinateBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    pub fn latitude(self, latitude: f64) -> Self {
        Self {
            builder: self.builder.property("latitude", latitude),
        }
    }

    pub fn longitude(self, longitude: f64) -> Self {
        Self {
            builder: self.builder.property("longitude", longitude),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`Coordinate`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> Coordinate {
        self.builder.build()
    }
}
