package com.ffii.fpsms.m18

import org.springframework.beans.factory.annotation.Value
import org.springframework.cloud.context.config.annotation.RefreshScope
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration


@Configuration
open class M18Config {

    // Account
    @Value("\${m18.config.grant-type}")
    lateinit var GRANT_TYPE: String;

    @Value("\${m18.config.client-id}")
    lateinit var CLIENT_ID: String;

    @Value("\${m18.config.client-secret}")
    lateinit var CLIENT_SECRET: String;

    @Value("\${m18.config.username}")
    lateinit var USERNAME: String;

    @Value("\${m18.config.password}")
    lateinit var PASSWORD: String;

    @Value("\${m18.config.base-url}")
    lateinit var BASE_URL: String;

    @Value("\${m18.config.base-url-uat}")
    lateinit var BASE_URL_UAT: String;

    // Supplier
//    var MATERIAL_PO_SUPPLIER_NOT: List<String> = listOf("P06", "P07", "T62"); // If need oem type

    @Value("\${m18.config.supplier-not.material-po}")
    lateinit var MATERIAL_PO_SUPPLIER_NOT: List<String>;

    @Value("\${m18.config.supplier.shop-po}")
    lateinit var SHOP_PO_SUPPLIER: List<String>;

    @Value("\${m18.config.supplier.oem-po}")
    lateinit var OEM_PO_SUPPLIER: List<String>;

    // Series
    @Value("\${m18.config.seriesId.pp}")
    lateinit var SERIESID_PP: String;

    @Value("\${m18.config.seriesId.pf}")
    lateinit var SERIESID_PF: String;

    @Value("\${m18.config.seriesId.sc}")
    lateinit var SERIESID_SC: String;

    @Value("\${m18.config.seriesId.se}")
    lateinit var SERIESID_SE: String;

    @Value("\${m18.config.seriesId.sf}")
    lateinit var SERIESID_SF: String;

    @Value("\${m18.config.seriesId.sr}")
    lateinit var SERIESID_SR: String;

    // BE
    @Value("\${m18.config.beId.pp}")
    lateinit var BEID_PP: String;

    @Value("\${m18.config.beId.pf}")
    lateinit var BEID_PF: String;

    @Value("\${m18.config.beId.toa}")
    lateinit var BEID_TOA: String;

    // Fetch
    var ACCESS_TOKEN: String? = null;

    /**
     * Condition Detail
     * Conds Format:
     * Id=lessThan=5=and=id=largerOrEqual=3=or=(name=contains =ss=or=name=contains=bb)
     * Which means:
     * Id<5 and id >=3 or (name like ‘%ss%’ or name like ‘%bb%’)
     * **Please use these formats to write the conds: **
     * ("equal", "="),
     * ("unequal", "<>"),
     * ("largerThan", ">"),
     * ("lessThan", "<"),
     * ("largerOrEqual", ">="),
     * ("lessOrEqual", "<="),
     * ("contains", "like"),
     * ("doseNotContain", "notlike"),
     * ("in", "in"),
     * ("notIn", "notin"),
     * ("startWith", "like"),
     * ("endWith", "like");
     */
}