// (c) 2025 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
syntax = "proto3";

import "ansys/api/speos/sensor/v1/camera_sensor.proto";
import "ansys/api/speos/sensor/v1/irradiance_sensor.proto";
import "ansys/api/speos/sensor/v1/common.proto";

package ansys.api.speos.sensor.v1;


service SensorTemplatesManager {
	// Create a SensorTemplate
	rpc Create(Create_Request) returns (Create_Response) {}
	// Read a SensorTemplate
	rpc Read(Read_Request) returns (Read_Response) {}
	// Update a SensorTemplate
	rpc Update(Update_Request) returns (Update_Response) {}
	// Delete a SensorTemplate
	rpc Delete(Delete_Request) returns (Delete_Response) {}
	// List all SensorTemplates in manager
	rpc List(List_Request) returns (List_Response) {}
}

// Sensor template with its basic characteristics
message SensorTemplate {
	string name = 4; // SensorTemplate name
	string description = 5; // SensorTemplate description
	map<string, string> metadata = 6; // User defined metadata
	oneof sensor_template {
		CameraSensorTemplate camera_sensor_template = 1;
		IrradianceSensorTemplate irradiance_sensor_template = 2;
		Radiance radiance_sensor_template = 3;
		Intensity intensity_sensor_template = 7;
		PolarIntensity polar_intensity_sensor_template = 8;
		Irradiance3D irradiance_3d = 9;
	}
	message Radiance {
		oneof sensor_type {
			ansys.api.speos.sensor.v1.SensorTypePhotometric sensor_type_photometric = 2; // Sensor type : Photometric
			ansys.api.speos.sensor.v1.SensorTypeColorimetric sensor_type_colorimetric = 3; //  Sensor type : Colorimetric
			ansys.api.speos.sensor.v1.SensorTypeRadiometric sensor_type_radiometric = 4; //  Sensor type : Radiometric
			ansys.api.speos.sensor.v1.SensorTypeSpectral sensor_type_spectral = 5; // Sensor type : Spectral
		}		
		double focal = 6; // Observer type : focal (mm)
		double integration_angle = 7; // Integration angle, in degree
		ansys.api.speos.sensor.v1.SensorDimensions dimensions = 8; // Dimensions of the sensor
	}
	message Intensity { // Carthesian intensity sensor, generating a XMP result
		oneof sensor_type {
			ansys.api.speos.sensor.v1.SensorTypePhotometric sensor_type_photometric = 2; // Sensor type: Photometric
			ansys.api.speos.sensor.v1.SensorTypeColorimetric sensor_type_colorimetric = 3; // Sensor type: Colorimetric
			ansys.api.speos.sensor.v1.SensorTypeRadiometric sensor_type_radiometric = 4; // Sensor type: Radiometric
			ansys.api.speos.sensor.v1.SensorTypeSpectral sensor_type_spectral = 5; // Sensor type: Spectral
		}
		oneof orientation {
			ansys.api.speos.sensor.v1.IntensityOrientationXAsMeridian intensity_orientation_x_as_meridian = 6; // Orientation type: X As Meridian, Y as Parallel
			ansys.api.speos.sensor.v1.IntensityOrientationXAsParallel intensity_orientation_x_as_parallel = 7; // Orientation type: X As Parallel, Y as Meridian
			ansys.api.speos.sensor.v1.IntensityOrientationConoscopic intensity_orientation_conoscopic = 8; // Orientation type: Conoscopic
		}
		
		ansys.api.speos.sensor.v1.SensorNearField near_field = 10; // Activates Near field. When not set, near field is disabled for the sensor

		oneof viewing_direction {
			ansys.api.speos.sensor.v1.FromSourceLookingAtSensor from_source_looking_at_sensor = 11; // Viewing direction from source looking at sensor
			ansys.api.speos.sensor.v1.FromSensorLookingAtSource from_sensor_looking_at_source = 12; // Viewing direction from sensor looking at source
		}
	}
	message PolarIntensity{
		oneof format {
			ansys.api.speos.sensor.v1.PolarIntensityIesnaA iesna_a = 1; // Sensor format: Iesna A type
			ansys.api.speos.sensor.v1.PolarIntensityIesnaB iesna_b = 2; // Sensor format: Iesna B type
			ansys.api.speos.sensor.v1.PolarIntensityIesnaC iesna_c = 3; // Sensor format: Iesna C type
			ansys.api.speos.sensor.v1.PolarIntensityEulumdat eulumdat = 4; // Sensor format: Eulumdat
		}
		oneof sampling {
			ansys.api.speos.sensor.v1.PolarIntensityDimensions dimensions = 5; // Horizontal and vertical samplings. Dimensions are fixed by the format or the adaptive sampling file
			string adaptive_sampling_uri = 6; // Path to the adaptive sampling file
		}
		oneof field {
			SensorFarField far_field = 8; // Far field, only used when near field is disabled for the sensor. It permits to set the integration angle.
			ansys.api.speos.sensor.v1.SensorNearField near_field = 7; // Near field parameters: cell distance and diameter. Integration angle needs to be calculated from these parameters.
		}

		message SensorFarField {
			double integration_angle = 1; // Integration angle (deg)
		}		
	}	

	message Irradiance3D {
		oneof sensor_type {
			TypePhotometric type_photometric = 1; // Sensor type : Photometric
			TypeColorimetric type_colorimetric = 2; //  Sensor type : Colorimetric
			TypeRadiometric type_radiometric = 3; //  Sensor type : Radiometric
		}

		// Integration made orthogonally with the sensor plane.
		message IntegrationTypePlanar {
			bool reflection = 1;  // Reflection is taking into account for the integrating faces of the sensor.
			bool transmission = 2; // Transmission is taking into account for the integrating faces of the sensor.
			bool absorption = 3; // Absorption is taking into account for the integrating faces of the sensor.
		}

		message IntegrationTypeRadial {}

		// The sensor considers the visible spectrum and gets the results in lm/m2 or lx.
		message TypePhotometric{
			oneof integration_type {
				IntegrationTypeRadial integration_type_radial = 1; // Integration type : Radial
				IntegrationTypePlanar integration_type_planar = 2; // Integration type : Planar
			}
		}

		// The sensor considers the entire spectrum and gets the results in W/m2.
		message TypeRadiometric{
			oneof integration_type {
				IntegrationTypeRadial integration_type_radial = 1; // Integration type : Radial
				IntegrationTypePlanar integration_type_planar = 2; // Integration type : Planar
			}
		}

		// Color results without any spectral data or layer separation (in lx or W//m2).
		message TypeColorimetric{
		    double wavelength_start = 1; // (nm)
		    double wavelength_end = 2; // (nm)
			IntegrationType integration_type = 3; // will determine the integration type of the sensor between radial and planar

			// Defines how the illuminance is integrated in the sensor
			enum IntegrationType {
			    Radial = 0; // Integration type : Radial
			    Planar = 1; // Integration type : Planar
		    }
		}
	}
}

// Request to create a SensorTemplate in SensorTemplatesManager
message Create_Request {
	SensorTemplate sensor_template = 1; // SensorTemplate containing its basic characteristics
}
message Create_Response {
	string guid = 1; // Guid of the SensorTemplate created in SensorTemplatesManager
}
// Request to read a SensorTemplate in SensorTemplatesManager
message Read_Request {
	string guid = 1; // Guid of the SensorTemplate to be read
}
message Read_Response {
	SensorTemplate sensor_template = 1; // SensorTemplate corresponding to the guid given in Read_Request
}
// Request to update a SensorTemplate in SensorTemplatesManager
message Update_Request {
	string guid = 1; // Guid of the SensorTemplate to be updated
	SensorTemplate sensor_template = 2; // SensorTemplate that will be used for the update
}
message Update_Response {
}
// Request to delete a SensorTemplate in SensorTemplatesManager
message Delete_Request {
	string guid = 1; // Guid of the SensorTemplate to be deleted
}
message Delete_Response {}

message List_Request {
}
message List_Response {
	repeated string guids = 1; // Guids of the SensorTemplates in SensorTemplatesManager
}

